我正在尝试将一个小小的sage单元/程序嵌入到我的网页中。但是,单元仅在用户按下激活按钮时激活。我希望单元格自动显示在页面上,这样用户就不必按下激活按钮,然后输入程序的值。我不知道怎么做到这一点。他们是否可以自动按下脚本创建的按钮?是他们以任何方式让细胞出现吗?
以下是源代码:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Sage Cell Server</title>
<script src="https://sagecell.sagemath.org/static/jquery.min.js"></script>
<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
<script>$(function () {
// Make the div with id 'mycell' a Sage cell
sagecell.makeSagecell({inputLocation: '#mycell',
template: sagecell.templates.minimal,
evalButtonText: 'Activate'});
hide: ['evalButton']
// Make *any* div with class 'compute' a Sage cell
});
</script>
</head>
<body>
<h2>Factorial</h2>
Click the “Activate” button below to calculate factorials.
<div id="mycell">
@interact
def _(a=(1, 10)):
print factorial(a)
</script>
</div>
</body>
</html>
以下是生成按钮的html:
<button type="button" class="sagecell_evalButton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Activate</span></button>