这段代码的问题在哪呢?总是提示说onmouseover标签的div属性不被支持。。。
但是我在前面的script中定义了divControl了啊。。。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">.menubar{position:absolute;top:10px;width:100px;height:20px;cursor:default;border-width:1px;border-style:outset;color:#00CCCC;background:#99CC33}.menu{position:absolute;top:32px;width:140px;display:none;border-width:2px;border-style:outset;border-color:#FFFFFF;background:#99CC33;padding:15px}.menu A{text-decoration:none;color:#00FF66}.menu A:hover{color:#FF6666}</style><script language="javascript">function divControl(show){window.event.concelBubble=true;var objID=event.srcElement.id;var index=objID.indexof("_");var mainID=objID.substring(0,index);var numID=objID.substring(index+1); if(mainID=="Tdiv"){ if(show==1){eval("showdiv("+"Div+"+numID+")");} else{eval("hidediv("+"Div+"+numID+")");} } }var nbottom=0,speed=2;function displayMenu(obj){obj.style.clip="rect(0 100% "+nbottom+"% 0)";nbottom+=speed;if(nbottom<=100){timerID=setTimeout("displayMenu("+obj.id+")");}else clearTimeout(timerID);}function showdiv(obj){obj.style.display="block";obj.style.clip="rect(0 0 0 0)";nbottom=5;displayMenu(obj);}function hidediv(obj){nbottom=0;obj.style.display="none";}function keepstyle(obj){obj.style.display="block";}</script><title>无标题文档</title></head><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size:15px"><tr><td width="20%"><div align="center" id="Tdiv_1" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">教育网站</div></td><td width="20%"><div align="center" id="Tdiv_2" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">电脑丛书</div></td><td width="20%"><div align="center" id="Tdiv_3" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">新出图书</div></td><td width="20%"><div align="center" id="Tdiv_4" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">其他</div></td></tr></tr><tr><td width="20%"><div align="left" id="Div1" class="menu" onmouseover="keepstyle(this)" onmouseout="hidediv(this)"><a href="#">北京大学</a><br><a href="#">北京航空航天大学</a><br><a href="#">北京工商大学</a></div></td></table></body></html>
回复讨论(解决方案)
<script> function divControl(show) { window.event.concelBubble = true;//只有IE支持此写法 var objID = event.srcElement.id;//只有IE支持此写法 var index = objID.indexOf("_"); var mainID = objID.substring(0, index); var numID = objID.substring(index + 1); if (mainID == "Tdiv") { if (show == 1) { showdiv(document.getElementById("Div" + numID)) } else { hidediv(document.getElementById("Div" + numID)) } } } var nbottom = 0, speed = 2, timerID=null; function displayMenu(obj) { nbottom += speed; if (nbottom <= 100) { timerID = setTimeout(function () { displayMenu(document.getElementById(obj.id)); }, 0); } else clearTimeout(timerID);}function showdiv(obj) { obj.style.display = "block"; //obj.style.clip = "rect(0 0 0 0)"; nbottom = 5; displayMenu(obj);}function hidediv(obj) { nbottom = 0; obj.style.display = "none";}function keepstyle(obj) { obj.style.display = "block";}</script>
<script> function divControl(show) { window.event.concelBubble = true;//只有IE支持此写法 var objID = event.srcElement.id;//只有IE支持此写法 var index = objID.indexOf("_"); var mainID = objID.substring(0, index); var numID = objID.substring(index + 1); if (mainID == "Tdiv") { if (show == 1) { showdiv(document.getElementById("Div" + numID)) } else { hidediv(document.getElementById("Div" + numID)) } } } var nbottom = 0, speed = 2, timerID=null; function displayMenu(obj) { nbottom += speed; if (nbottom <= 100) { timerID = setTimeout(function () { displayMenu(document.getElementById(obj.id)); }, 0); } else clearTimeout(timerID);}function showdiv(obj) { obj.style.display = "block"; //obj.style.clip = "rect(0 0 0 0)"; nbottom = 5; displayMenu(obj);}function hidediv(obj) { nbottom = 0; obj.style.display = "none";}function keepstyle(obj) { obj.style.display = "block";}</script>解决不了问题啊。。。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">.menubar{position:absolute;top:10px;width:100px;height:20px;cursor:default;border-width:1px;border-style:outset;color:#00CCCC;background:#99CC33}.menu{position:absolute;top:32px;width:140px;display:none;border-width:2px;border-style:outset;border-color:#FFFFFF;background:#99CC33;padding:15px}.menu A{text-decoration:none;color:#00FF66}.menu A:hover{color:#FF6666}</style><script language="javascript">function divControl(show){window.event.concelBubble=true;var objID=event.srcElement.id;var index=objID.indexOf("_");var mainID=objID.substring(0,index);var numID=objID.substring(index+1); if(mainID=="Tdiv"){ if(show==1){ showdiv(document.getElementById("Div" + numID)); }else{ hidediv(document.getElementById("Div" + numID)); } } }var nbottom=0,speed=2;function displayMenu(obj){//obj.style.clip="rect(0 100% "+nbottom+"% 0)";nbottom+=speed;if(nbottom<=100){timerID=setTimeout("displayMenu("+obj.id+")");}else clearTimeout(timerID);}function showdiv(obj){obj.style.display="block";//obj.style.clip="rect(0 0 0 0)";//nbottom=5;//displayMenu(obj);}function hidediv(obj){nbottom=0;obj.style.display="none";}function keepstyle(obj){obj.style.display="block";}</script><title>无标题文档</title></head><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size:15px"><tr><td width="20%"><div align="center" id="Tdiv_1" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">教育网站</div></td><td width="20%"><div align="center" id="Tdiv_2" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">电脑丛书</div></td><td width="20%"><div align="center" id="Tdiv_3" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">新出图书</div></td><td width="20%"><div align="center" id="Tdiv_4" class="menubar" onmouseover="divControl(1)" onmouseout="divControl(0)">其他</div></td></tr></tr><tr><td width="20%"><div align="left" id="Div1" class="menu" onmouseover="keepstyle(this)" onmouseout="hidediv(this)"><a href="#">北京大学</a><br><a href="#">北京航空航天大学</a><br><a href="#">北京工商大学</a></div><div align="left" id="Div2" class="menu" onmouseover="keepstyle(this)" onmouseout="hidediv(this)"><a href="#">北京大学</a><br><a href="#">北京航空航天大学</a><br><a href="#">北京工商大学</a></div></td></table></body></html>
一开启
obj.style.clip="rect(0 0 0 0)";
IE8测试就没反应,查了msdn,也没找到为啥

HTML、CSS和JavaScript是构建现代网页的核心技术:1.HTML定义网页结构,2.CSS负责网页外观,3.JavaScript提供网页动态和交互性,它们共同作用,打造出用户体验良好的网站。

HTML的功能是定义网页的结构和内容,其目的在于提供一种标准化的方式来展示信息。1)HTML通过标签和属性组织网页的各个部分,如标题和段落。2)它支持内容与表现分离,提升维护效率。3)HTML具有可扩展性,允许自定义标签增强SEO。

HTML的未来趋势是语义化和Web组件,CSS的未来趋势是CSS-in-JS和CSSHoudini,JavaScript的未来趋势是WebAssembly和Serverless。1.HTML的语义化提高可访问性和SEO效果,Web组件提升开发效率但需注意浏览器兼容性。2.CSS-in-JS增强样式管理灵活性但可能增大文件体积,CSSHoudini允许直接操作CSS渲染。3.WebAssembly优化浏览器应用性能但学习曲线陡,Serverless简化开发但需优化冷启动问题。

HTML、CSS和JavaScript在Web开发中的作用分别是:1.HTML定义网页结构,2.CSS控制网页样式,3.JavaScript添加动态行为。它们共同构建了现代网站的框架、美观和交互性。

HTML的未来充满了无限可能。1)新功能和标准将包括更多的语义化标签和WebComponents的普及。2)网页设计趋势将继续向响应式和无障碍设计发展。3)性能优化将通过响应式图片加载和延迟加载技术提升用户体验。

HTML、CSS和JavaScript在网页开发中的角色分别是:HTML负责内容结构,CSS负责样式,JavaScript负责动态行为。1.HTML通过标签定义网页结构和内容,确保语义化。2.CSS通过选择器和属性控制网页样式,使其美观易读。3.JavaScript通过脚本控制网页行为,实现动态和交互功能。

HTMLISNOTAPROGRAMMENGUAGE; ITISAMARKUMARKUPLAGUAGE.1)htmlStructures andFormatSwebContentusingtags.2)itworkswithcsssforstylingandjavascript for Interactivity,增强WebevebDevelopment。

HTML是构建网页结构的基石。1.HTML定义内容结构和语义,使用、、等标签。2.提供语义化标记,如、、等,提升SEO效果。3.通过标签实现用户交互,需注意表单验证。4.使用、等高级元素结合JavaScript实现动态效果。5.常见错误包括标签未闭合和属性值未加引号,需使用验证工具。6.优化策略包括减少HTTP请求、压缩HTML、使用语义化标签等。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

禅工作室 13.0.1
功能强大的PHP集成开发环境

SublimeText3汉化版
中文版,非常好用

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)