Maison > Article > interface Web > 一个小问题。。。_html/css_WEB-ITnose
这段代码的问题在哪呢?总是提示说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,也没找到为啥