1、以事件驱动JavaScript 函数
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
<!--
function hello()
{
aa=100
cc='欢迎第' aa '次光临!'
alert(cc)
}
//-->
</script>
</head>
<body >
<a href="http://www.chinahtml.com" onmouseover="hello()"> 网页陶吧</a>
</body>
</html>
2、文本域显示内容,但不可修改
<input value="网页陶吧" readonly>
3、让select控件可以自定义边框
<style>
.box2{border:1px solid #00ff00;width:180px;height:17px;clip:rect(0px,179px,16px,0px);overflow:hidden;}
select{position:relative;left:-2px;top:-2px;font-size:12px;width:183px;line-height:14px;border:0px;color:#909993;}
</style>
<div class=box2><select id=idselect1 onchange="select1();" hidefocus>
<option selected>站长资讯</option>
<option>设计在线</option>
<option>办公软件</option>
<option>工具软件<option>
</select></div>
4、实现弹出菜单
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body topmargin="0" leftmargin="0" bgcolor="#FFFFFF" onclick="menuHide();">
<script>
document.onmousewheel=function()
{
status=event.wheelDelta;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
.menuover { background-color: #FFeeee; border: 1px solid #FF0000; cursor: hand; }
.menuout { cursor: hand; }
td,a { color: #ff0000; font-size: 12px; font-family: 宋体; text-decoration: none }
-->
</style>
<script language=javascript>
var run=0;
var show=0;
function menuRow()
{
show=1;
run=1;
menu.style.pixelTop-=1;
if(menu.style.pixelTop>0)
setTimeout('menuRow();','5');
else
run=0;
}
function menuShow()
{
if(!run&&!show)
{
menu.style.visibility='visible';
menup.style.visibility='visible';
menu.style.pixelTop=200;
menuRow();
}
}
function menuHide()
{
if(!run&&show)
{
menu.style.visibility='hidden';
menup.style.visibility='hidden';
show=0;
}
}
</script>
<div style="overflow: hidden; left:404px; top:30px; height:200px;
width:97px; z-index:1; position:absolute; visibility:hidden; border-left: 0px; border-right: 0px;
评论加载中…
![]() |