试试看
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<script type="text/javascript">
<!--
function reg()
{
var objs = document.getElementsByTagName("input"); for(var i=0; i<objs.length; i++)
{
objs[i].attachEvent("onfocus",function(){event.srcElement.style.backgroundColor="#00ff00";});
}
}
//-->
</script><input type="button" size="15" value="提交表单">
<input type="button" size="15" value="重 置">
<input type="button" size="15" value="Submit">
<input type="button" size="15" value="Reset"><script type="text/javascript">
<!--
window.onload=reg;
//-->
</script>
</body>
</html>
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<script type="text/javascript">
<!--
function reg()
{
var objs = document.getElementsByTagName("input"); for(var i=0; i<objs.length; i++)
{
objs[i].attachEvent("onfocus",function(){event.srcElement.style.backgroundColor="#00ff00";});
}
}
//-->
</script><input type="button" size="15" value="提交表单">
<input type="button" size="15" value="重 置">
<input type="button" size="15" value="Submit">
<input type="button" size="15" value="Reset"><script type="text/javascript">
<!--
window.onload=reg;
//-->
</script>
</body>
</html>
解决方案 »
- 如何使用CSS+DIV做出一个类似于Google地图那样的界面
- 在视频里添加 鼠标双击事件 的疑问
- 急问alert显示问题
- 那位大哥有键盘的代码(屏蔽特殊键用),或者给一个按下键盘就显示键盘代码的例子
- 关于日期转换问题!!!
- 虚心请教:在html上怎样动态控制被调用的窗体(窗体为VC做的com组件)大小,让这个窗体充满整个html网页,并可随着网页大小的改变而相应的改变
- 可以屏蔽浏览器的后退按钮吗?
- 几个简单问题
- 怎么做一个充值的界面啊,能传数据到后台的
- 如何给若干个div隔行命名class,如第一个div,class=“left”,第二个div的class=“right”,第三个div的class=“left”
- Ext2.0的TabPanel,可否让所有标签内容(contentEl)指向同一个东西(比如同一个div) ?
- js中的地址
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<script type="text/javascript">
<!--
function reg()
{
var objs = document.getElementsByTagName("input"); for(var i=0; i<objs.length; i++)
{
objs[i].onfocus=function(e){
var objTarget;
if(document.all){
event.srcElement.style.backgroundColor="#00ff00";
}else{
e.target.style.backgroundColor="#00ff00";
}
};
}
}
//-->
</script>
<div id="test"></div>
<input type="button" size="15" value="提交表单">
<input type="button" size="15" value="重 置">
<input type="button" size="15" value="Submit">
<input type="button" size="15" value="Reset"><script type="text/javascript">
<!--
window.onload=reg;
//-->
</script>
</body>
</html>
[/html]