Javascript 如何在xhtml中使用字幕标记

Javascript 如何在xhtml中使用字幕标记,javascript,xhtml,validation,marquee,Javascript,Xhtml,Validation,Marquee,我正在使用 <script type="text/javascript" > document.write("<marquee scrollamount='5' onMouseOver='this.stop()' onMouseOut='this.start()'><img alt='ibm' src='images/ibm.png' width='100px' height='100%' /><img alt='tcs' src='images

我正在使用

<script type="text/javascript" >
    document.write("<marquee scrollamount='5' onMouseOver='this.stop()' onMouseOut='this.start()'><img alt='ibm' src='images/ibm.png' width='100px' height='100%' /><img alt='tcs' src='images/tcs.jpg' width='100px' height='100%' /><img alt='hp' src='images/hp.png' width='100px' height='100%' /><img alt='hcl' src='images/hcl.jpg' width='100px' height='100%' /><img alt='cts' src='images/cts.jpg' width='100px' height='100%' /><img alt='accenture' src='images/Accenture.png' width='100px' height='100%' /></marquee>");
    </script>

文件。填写(“”);
用于我网站中的字幕图片,但当我将我的网页签入 ,那么我得到了上面代码的错误

  • 元素“marquee”未定义
  • 没有“onMouseOver”属性
  • 没有“scrollamount”属性
  • 没有“onMouseOut”属性

需要帮助才能解决上述问题

你的问题中解释了这些问题

  • marquee
    是微软的老东西,不应该使用它
  • onMouseOver
    也不是定义的属性。您可以在mouseover上使用
    onmouseover
    ,但可以使用不引人注目的事件处理程序
  • 其他问题可以用上述内容来解释
一些额外的提示

  • 在当今时代,使用
    document.write()
    marquee
    元素的原因很少。这两种方法都可以使用JavaScript中更优雅、更强大的手段来实现
  • img
    元素
    width
    height
    属性不应包括
    px
  • 如果您使用的是HTML5 doctype,如果脚本类型为
    text/javascript
    ,则
    type
    属性不再需要在
    script
    元素上使用

“字幕未在任何HTML规范中定义”-它无效,但已定义。