Home  >  Article  >  Web Front-end  >  A small problem. . . _html/css_WEB-ITnose

A small problem. . . _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:23:051016browse

What’s the problem with this code? It always prompts that the div attribute of the onmouseover tag is not supported. . .
But I defined divControl in the previous 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){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>


Reply to discussion (solution)

This post was last edited by net_lover on 2013-08-02 20:28:24

<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>
It can’t solve the problem. . .

<!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>

As soon as I open
obj.style.clip="rect(0 0 0 0)";
There is no response in the IE8 test. I checked msdn and found that Not found why

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn