先贴一段代码:<script language="javascript">document.writeln("<div style=\"display: block;z-index: 719272;width: 219px;height: 129px;position: fixed;margin-top: 0px;margin-left: 0px;left: 0px;bottom: 0px;_position: absolute;_margin-top: 0px;_margin-left: 0px;_top:expression(eval(document.documentElement.clientHeight + document.documentElement.scrollTop-this.offsetHeight-10));overflow:hidden;\"><div id=\"353808\" style=\"width:214px; height:124px; position:relative\">");
document.writeln("<img src=\"http://www.baidu.com/img/baidu_sylogo1.gif\" />");
document.writeln("</div></div>");
document.writeln("<script language=\"javascript\">");
document.writeln("function zd(u){ ");
document.writeln(" var a=[\'top\',\'left\'],b=0;");
document.writeln(" u=setInterval(function(){");
document.writeln("  document.getElementById(\'353808\').style[a[b%2]]=(b++)%4<2?0:4;");
document.writeln("  if(b>15){clearInterval(u);b=0}");
document.writeln(" },32)");
document.writeln(" setTimeout(\"zd()\",2000);");
document.writeln("}");
document.writeln("zd()");
document.writeln("</scr"+"ipt>");
document.writeln("<input type=\"submit\" name=\"Submit\" value=\"震动\" onclick=\"zd()\" \/>")</script>
上面这段代码保存为.html能被谷歌和火狐执行,但是,遇到下面的情况后谷歌和火狐就不能执行了:创建一个名为1.php的文件:<?php
echo 'document.writeln("<div style=\"display: block;z-index: 719272;width: 219px;height: 129px;position: fixed;margin-top: 0px;margin-left: 0px;left: 0px;bottom: 0px;_position: absolute;_margin-top: 0px;_margin-left: 0px;_top:expression(eval(document.documentElement.clientHeight + document.documentElement.scrollTop-this.offsetHeight-10));overflow:hidden;\"><div id=\"353808\" style=\"width:214px; height:124px; position:relative\">");';
echo 'document.writeln("<img src=\"http://www.403yiyuan.com/img/shqqdd.gif\" />");';
echo 'document.writeln("</div></div>");';
echo 'document.writeln("<script language=\"javascript\">");';
echo 'document.writeln("function zd(u){ ");';
echo 'document.writeln(" var a=[\'top\',\'left\'],b=0;");';
echo 'document.writeln(" u=setInterval(function(){");';
echo 'document.writeln("  document.getElementById(\'353808\').style[a[b%2]]=(b++)%4<2?0:4;");';
echo 'document.writeln("  if(b>15){clearInterval(u);b=0}");';
echo 'document.writeln(" },32)");';
echo 'document.writeln(" setTimeout(\"zd()\",2000);");';
echo 'document.writeln("}");';
echo 'document.writeln("zd()");';
echo 'document.writeln("</scr"+"ipt>");';
echo 'document.writeln("<input type=\"submit\" name=\"Submit\" value=\"提交\" onclick=\"zd()\" \/>")';
?>创建一个名为get.html的文件:<html>
<head>
<title>test</title>
</head>
<body>
<script src="1.php"></script>
</body>
</html>
用get.html调用1.php,会输出和最上面一样的代码,可是火狐谷歌不执行,不知道为什么不要说换行符的问题,加上换行符也一个样,愁人还望各位高手指点一二!十分感谢!!!

解决方案 »

  1.   

    document.writeln("  document.getElementById(\'353808\').style[a[b%2]]=(b++)%4<2?0:4;");
    改成
    document.writeln("  document.getElementById【\'353808\'】.style[a[b%2]]=(b++)%4<2?0:4;");
      

  2.   

    document.writeln("<script language=\"javascript\">");
    document.writeln("function zd(u){ ");
    document.writeln(" var a=[\'top\',\'left\'],b=0;");
    document.writeln(" u=setInterval(function(){");
    document.writeln("  document.getElementById[\'614487\'].style[a[b%2]]=(b++)%4<2?0:4;");
    document.writeln("  if(b>15){clearInterval(u);b=0}");
    document.writeln(" },32)");
    document.writeln(" setTimeout(\"zd()\",2000);");
    document.writeln("}");
    document.writeln("zd();");
    document.writeln("</script>");按照楼上说的改了,还是不行。
      

  3.   

    PHP中不是直接echo "<script LANGUAGE='javascript'>XXX</script>"; 
    这样写的么,为什么还要
    echo 'document.writeln("<img src=\"http://www.403yiyuan.com/img/shqqdd.gif\" />");';