首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

那位大哥/大姐能告诉小弟我如何改变"层"中的内容啊

2012-02-20 
那位大哥/大姐能告诉我怎么改变层中的内容啊~!!!大意就是,鼠标指到黑龙江,层里显示 黑龙江 ,指到吉林

那位大哥/大姐能告诉我怎么改变"层"中的内容啊~!!!
大意就是,鼠标指到黑龙江,层里显示 "黑龙江 ",指到吉林显示 "吉林 ",我不想每个省都弄个层,想只用一个层内容根据位置变化.

因为显示的黑龙江几个字必须是超连接,所以我就知道用层能实现.

谢谢各位了~小弟昨天才开始学习稍微复杂点的html.

贴上来的代码没什么用,写的也超级次,主要怕说不清楚.

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "
"http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>

<script   language= "JavaScript "   type= "text/JavaScript ">
<!--
function   MM_reloadPage(init)   {     //reloads   the   window   if   Nav4   resized
    if   (init==true)   with   (navigator)   {if   ((appName== "Netscape ")&&(parseInt(appVersion)==4))   {
        document.MM_pgW=innerWidth;   document.MM_pgH=innerHeight;   onresize=MM_reloadPage;   }}
    else   if   (innerWidth!=document.MM_pgW   ||   innerHeight!=document.MM_pgH)   location.reload();
}
MM_reloadPage(true);
  function   mousemove()
  {

document.body.all( "Layer1 ").style.visibility= "visible "

  }
  function   mouseout()
  {

document.body.all( "Layer1 ").style.visibility= "hidden "

  }
function   showDiv(state)
{
document.all.Layer1.style.display=state;
}
function   showDiv2(state,left,top)
{
document.all.Layer1.style.display=state;
document.all.Layer1.style.left=left;
document.all.Layer1.style.top=top;

        }
//-->

</script>
</head>

<body>
<img   src= "../china-map.gif "   width= "506 "   height= "404 "   border= "0 "   usemap= "#Map "       >
<map   name= "Map ">
    <area     onmouseover= "showDiv2( 'block ',464,72); "         shape= "poly "   coords= "389,16,387,8,390,3,414,3,423,15,437,35,463,49,491,38,491,52,491,72,480,77,482,95,470,93,460,97,454,91,441,86,433,83,417,79,410,73,404,64,418,52,419,39,419,29,419,23,413,20,404,24,396,16 ">
    <area       onMouseMove= "showDiv2( 'block ',429,145); "   shape= "poly "   coords= "400,150,390,141,395,127,397,131,424,117,426,111,444,131,432,148,417,157,416,141,414,136,408,136 "   href= "# ">
    <area     onmouseover= "showDiv( 'none '); "   shape= "poly "   coords= "419,4,460,39,491,37,501,34,502,3 "   href= "# ">
    <area   onmouseover= "showDiv( 'none '); "   shape= "poly "   coords= "501,392,502,41,494,41,482,99,466,122,439,151,431,174,411,209,437,237,441,267,428,294,414,320,321,398 "   href= "# ">
</map>
<div         id= "Layer1 "   style= "position:absolute;   width:111px;   height:93px;   z-index:1;   left:   650px;   top:   72px;   background-color:   #FFFFCC;   layer-background-color:   #FFFFCC;   border:   1px   none   #000000;   display:none ">


    <div   align= "left "> <a   href= "http://mail.163.com "> 黑龙江 </a> </div>
</div>
</body>
</html>


[解决办法]
通过改变对象的innerHTML来改变对象的内容!
[解决办法]
innerHTML就是对象内部的html
<div id= 'div1 '> aa </div>
用 document.getElementById( "div1 ").innerHTML= 'bb ';
就可以改变其内部的文本,这个在ie下没问题,在别的浏览器下待测试

热点排行