日期:2014-05-16  浏览次数:20296 次

marquee属性可以用js调用吗
我有几个页面都需要用到同样滚动的模块,我想用JS调用,我下面的这个转换成JS好像不行,请问一下,是marquee属性不能用JS调用还是其他的原因,谢谢
HTML code

<DIV><MARQUEE style="WIDTH: 220; HEIGHT: 260" scrollAmount=1 scrollDelay=77 direction=up width=280 height=200 onmouseout="this.start()" onmouseover="this.stop()">
<p>
   001<br />
   002<br />
   003<br />
   004<br />
      </p>
   </MARQUEE></DIV>


JScript code
document.writeln("<DIV><MARQUEE style=\"WIDTH: 220; HEIGHT: 260\" scrollAmount=1 scrollDelay=77 direction=up width=280 height=200 onmouseout=\"this.start()\" onmouseover=\"this.stop()\">
");
document.writeln("<p>
");
document.writeln("   001<br />
");
document.writeln("   002<br />
");
document.writeln("   003<br />
");
document.writeln("   004<br />
");
document.writeln("      </p>
");
document.writeln("   </MARQUEE></DIV>
");
document.writeln("");


------解决方案--------------------
字符串后面多一个换行干啥?
HTML code
<body>
<script>
document.writeln("<DIV><MARQUEE style=\"WIDTH: 220; HEIGHT: 260\" scrollAmount=1 scrollDelay=77 direction=up width=280 height=200 onmouseout=\"this.start()\" onmouseover=\"this.stop()\">");
document.writeln("<p>");
document.writeln("   001<br />");
document.writeln("   002<br />");
document.writeln("   003<br />");
document.writeln("   004<br />");
document.writeln("      </p>");
document.writeln("   </MARQUEE></DIV>");
document.writeln("");
</script>
</body>

------解决方案--------------------
这样更方便一些。
HTML code
<body>
<script>
document.write('\
<DIV><MARQUEE style="WIDTH: 220; HEIGHT: 260" scrollAmount=1 scrollDelay=77 direction=up width=280 height=200 onmouseout="this.start()" onmouseover="this.stop()">\
<p>\
   001<br />\
   002<br />\
   003<br />\
   004<br />\
      </p>\
</MARQUEE></DIV>');
</script>
</body>