-1

我的客户将我们下面的 JS 代码放在他的网站中,<head>并抱怨我们的标签没有触发。以下是来自客户端的示例代码:

    <html>
    <head>
    <script type="text/javascript">
    function create() {
    try {
    var baseURL = "https://serv2ssl.vizury.com/analyze/analyze.php?account_id=VIZVRM1125";
    var analyze = document.createElement("iframe");
    analyze.src = baseURL;
    var node = document.getElementsByTagName("script")[0];
    node.parentNode.insertBefore(analyze, node);
} catch (i) {
}
}
 var existing = window.onload;
window.onload = function() {
if (existing) {
    existing();
}
create();
}
  </script>
 </head>

 <body onload="javascript:clientfunction();">
 <script type="text/javascript">

function clientfunction()
{
   //client code is replcad here
   document.write("Hello testing");
}
 </script>

  </body>
 </html>

在页面加载clientfunction()调用时,我们的create()函数没有触发。

请任何人都可以帮助我为什么我们的标签没有触发,这个问题的替代解决方案是什么?

4

1 回答 1

-1

复制粘贴并检查以下运行

<html>
<head>
<script type="text/javascript">
function create() {
alert("Gdfg");
try {
var baseURL = "https://serv2ssl.vizury.com/analyze/analyze.php?account_id=VIZVRM1125";
var analyze = document.createElement("iframe");
analyze.src = baseURL;
var node = document.getElementsByTagName("script")[0];
node.parentNode.insertBefore(analyze, node);
} catch (i) {
}
}

window.onload=create;
window.onload=clientfunction;
</script>
</head>

<body onload="clientfunction(); create()">
<script type="text/javascript">

function clientfunction()
{
alert("fdsfsdf");
//client code is replcad here
document.write("Hello testing");
}
</script>

</body>
</html>
于 2013-09-27T14:25:29.073 回答