我的目标是将这个 javascript 代码放入 wordpress php 中,但我不知道如何在不收到错误消息的情况下执行此操作。最终目标是将 javascript 游戏简单地嵌入到 wordpress 页面上。我已经检查了几十篇其他文章,但没有一篇对这样的代码足够具体。我希望包含在 php 中的代码仅在下面带有虚拟网站链接。希望你能帮助我!提前致谢。
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {
codebase: 'my_website',
code: 'vNES.class',
archive: 'my_website',
width: 512,
height: 480
};
var parameters = {
sound: "on",
timeemulation: "on",
fps: "off",
stereo: "off",
rom: "my_website/game.zig",
showsoundbuffer: "off",
scale: "on",
scanlines: "off",
nicesound: "on",
romsize: 40976
};
deployJava.setInstallerType('online');
// deployJava.setInstallerType('kernel');
if (deployJava.versionCheck('1.5+')) {
deployJava.runApplet(attributes, parameters, '1.5');
} else {
document.write("<br />");
document.write("<b style='color: red;'>Your browser does not appear to have Java installed.</b>");
document.write("<b><a href='#' onclick='javascript:deployJava.installLatestJRE();'>Click here to install the Java run-time.</a></b><br /><br />");
if (navigator.userAgent.indexOf("Chrome") != -1 && navigator.userAgent.indexOf("Mac OS X") != -1) {
document.write("<b style='color: red;'>");
document.write("Please note that Google Chrome under MacOS X does currently not support Java applets, so consider temporarily switching to Firefox or Safari if you are a MacOS X user.<br /><br />");
document.write("</b>");
}
document.write("This page has been tested and works with the latest versions of the following Windows browsers: Firefox, Google Chrome, Internet Explorer, Opera and Safari.<br /><br />");
document.write("This page has been tested and works with the latest versions of the following MacOS X browsers: Firefox, Opera and Safari.<br /><br />");
}
</script>