html-div 操作

@charset "utf-8";

div
{
width:100px;
height:100px;
border:solid 5px red;
background-color:black;
float:left;
margin:5px 5px;
}
#divpink
{
background-color:pink;
}
#divpurple
{
background-color:purple;
}
div.graydivs
{
background-color:gray;
}
.yellowdivs
{
background-color:yellow;
}

    JavaScript 中的onmouseover事件

                                 在<table>中可以编写onmouseover事件发生时执行的操作。例如改变表格的背景色。

<html>

<head>

<script language=”Javascript”>

Var currid=0;

Var pried=0;

Function showlayer(orl)

{

if(pried!=0)

{

Var prediv=document.getElementById(“type+preid”);

Prediv.style.display=”none”;

}

Currid=obj.id

Var currdiv= document.getElementById(“type+currid”);

Currdiv.style.display=””;

Pried=currid;

}

</script>

<//head>

<body>

<div id=1 onmouseover=”showlayer(this);” style=”background-color:red;”>Helloworld</div>

<div id=type1 style=”display:none;”>Hello,world</div>

<div id=2 onmouseover=”showlayer(this);” style=”background-color:aqua;”>myfriend世界</div>

<div id=type1 style=”display:none;”> myfriend,世界</div>

</body>

</html>                                                         

                                                                                                                                                                      T

posted @ 2012-12-22 16:28  默默前行  阅读(166)  评论(0)    收藏  举报