DTD XHTML 1.0 Strict标准中css使用Event (event:expression)属性不起作用,怎么办?
时间:2010-08-06
来源:互联网
下面的代码,不添加DTD XHTML 1.0 Strict限制, css中event javascript就可以运行,加上就无法运行..怎么办?
HTML code
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:o="urn:schemas-microsoft-com:office:office" __expr-val-dir="ltr" lang="zh-cn" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>rowIndex</title> <style media="all" type="text/css"> <!-- body { margin: 0px; font-family: 宋体, MS Song; font-size: 9pt; color: windowtext; background: threedface; } div.Page_Load { margin-left: 40px; margin-top: 20px; } table.Main { border: 1px solid #A9A9A9; width: 400px; background-color: White; }table.Main tr { background-color: expression( (this.rowIndex%2==0) ? "#F7F7F7" : "#FFFFFF" ); event:expression( onmouseover = function() { this.style.backgroundColor = ( this.style.backgroundColor != '#efefef' ? '#efefef' : ( (this.rowIndex % 2 == 0) ? "#F7F7F7" : "#FFFFFF") ) }, onmouseout = function() { this.style.backgroundColor = ( this.style.backgroundColor != '#efefef' ? '#efefef' : ( (this.rowIndex % 2 == 0) ? "#F7F7F7" : "#FFFFFF") ) } )}table.Main tr td { text-indent: 1.2em; }--> </style> </head><body> <div class="Page_Load"><table class="Main"> <tr> <td>1</td> </tr> <tr> <td>2</td> </tr> <tr> <td>3</td> </tr> <tr> <td>4</td> </tr> <tr> <td>5</td> </tr> <tr> <td>6</td> </tr> <tr> <td>7</td> </tr> <tr> <td>8</td> </tr> <tr> <td>9</td> </tr> </table></div> </body> </html>
作者: cppshooter 发布时间: 2010-08-06
可能是 css中event javascript 不符合DTD XHTML 1.0 Strict的标准,所以无效
作者: feng5799 发布时间: 2010-08-06
feng5799: 怎么解决..?
作者: cppshooter 发布时间: 2010-08-06
DTD XHTML 1.0 Transitional 试试
作者: feng5799 发布时间: 2010-08-06
或者不要用 css event javascript ,而采用js的方法
作者: feng5799 发布时间: 2010-08-06
Feng5799:不是最根本的解决办法
作者: cppshooter 发布时间: 2010-08-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28