processing.js 更改脚本源
我需要找到一种方法,可以动态更改 HTML 文档内的处理脚本的源。
这是运行良好的嵌入式脚本:
<script type='application/processing' src='sketch.txt' id="applet">
</script>
现在我尝试更改源:
$('#applet').attr('src', 'sketch2.txt');
alert($('#applet').attr('src'));
警报显示源已更改为“sketch2.txt”,但小程序仍然保持不变。我想我需要以某种方式刷新脚本。
预先感谢您的帮助!
I need to find a way where I can dynamically change the source of a processing script inside an HTML document.
This is the embedded script which works fine:
<script type='application/processing' src='sketch.txt' id="applet">
</script>
Now I try to change the source:
$('#applet').attr('src', 'sketch2.txt');
alert($('#applet').attr('src'));
The alert shows that the source was changed to 'sketch2.txt' but the applet still remains the same. I think I need to refresh the script in some way.
Thank you in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您必须手动将每个过程附加到画布,而不是仅仅更改源文件。这在这里起作用:
I believe you have to manually attach each proc to the canvas, instead of just changing the the source file. This worked here: