我一直收到这条消息。当我在“经典”HTML页面中尝试它时,它工作正常。但是当我在VS 2013中尝试时,我遇到了这个问题。
ms-appx第9行第9行未处理的异常://eabd59c7-f115-49ff-9716-94243f12fc3b/js/Action.js 0x800a138f - JavaScript运行时错误:无法获取未定义或null的属性“slice”和借鉴
我是新来的。有人能帮我吗?!这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Sage_Cell_Server</title>
<!-- WinJS references -->
<link href="//Microsoft.WinJS.2.0/css/ui-dark.css" rel="stylesheet" />
<script src="//Microsoft.WinJS.2.0/js/base.js"></script>
<script src="//Microsoft.WinJS.2.0/js/ui.js"></script>
<!-- Sage_Cell_Server references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
<script src="/js/jquery-2.1.1.min.js"></script>
<script src="/js/Action.js"></script>
<script>
$(function () {
// Make *any* div with class 'compute' a Sage cell
sagecell.makeSagecell({
inputLocation: 'div.compute',
template: sagecell.templates.minimal,
evalButtonText: 'Evaluate'
});
// Make the div with id 'mycell' a Sage cell
sagecell.makeSagecell({
inputLocation: '#mycell',
template: sagecell.templates.minimal,
evalButtonText: 'Activate'
});
});
</script>
</head>
<body>
<h1>Embedded Sage Cells</h1>
<h2>Factorial</h2>
Click the “Activate” button below to calculate factorials.
<div id="mycell">
<script type="text/x-sage">
@interact
def _(a=(1, 10)):
print factorial(a)
</script>
</div>
<h2>Your own computations</h2>
Type your own Sage computation below and click “Evaluate”.
<div class="compute">
<script type="text/x-sage">
plot(sin(x), (x, 0, 2*pi))
</script></div>
<div class="compute">
<script type="text/x-sage">
@interact
def f(n=(0,10)):
print 2^n
</script>
</div>
</body>
</html>
Action.js ---&gt;这是问题
var _gaq = _gaq || [];
_gaq.push(['sagecell._setAccount', 'UA-29124745-1']);
_gaq.push(['sagecell._setDomainName', 'sagemath.org']);
_gaq.push(['sagecell._trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function() {
"use strict";
var undefined;
// Make a global sagecell namespace for our functions
window.sagecell = window.sagecell || {};
if (!document.head) {
document.head = document.getElementsByTagName("head")[0];
}
var $ = jQuery.noConflict(true);
if (jQuery === undefined) {
window.$ = jQuery = $;
}
sagecell.jQuery = $;
sagecell.URLs = {};
(function () {
/* Read the Sage Cell server's root url from one of the following locations:
1. the variable sagecell.root
2. a tag of the form <link property="sagecell-root" href="...">
3. the root of the URL of the executing script */
var el;
if (sagecell.root) {
sagecell.URLs.root = sagecell.root;
} else if ((el = $("link[property=sagecell-root]")).length > 0) {
sagecell.URLs.root = el.last().attr("href");
} else {
/* get the first part of the last script element's src that loaded something called 'embedded_sagecell.js'
also, strip off the static/ part of the url if the src looked like 'static/embedded_sagecell.js'
modified from MathJax source
We could use the jquery reverse plugin at http://www.mail-archive.com/discuss@jquery.com/msg04272.html
and the jquery .each() to get this as well, but this approach avoids creating a reversed list, etc. */
var scripts = (document.documentElement || document).getElementsByTagName("script");
var namePattern = /^.*?(?=(?:static\/)?embedded_sagecell.js)/;
for (var i = scripts.length-1; i >= 0; i--) {
var m = (scripts[i].src||"").match(namePattern);
if (m) {
var r = m[0];
break;
}
}
if (r === "" || r === "/") {
r = window.location.protocol + "//" + window.location.host + "/";
}
sagecell.URLs.root = r;
}
if (sagecell.URLs.root.slice(-1) !== "/") {
sagecell.URLs.root += "/";
}
}());
...