Js--表单那点事儿

来源:互联网 发布:head first python 2 编辑:程序博客网 时间:2024/05/29 10:57


<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>表单元素bug</title>

<style>

#txt{ display:none;}

</style>

</head>


<body>

<input id="btn" type="button" />

<input id="txt" type="text" />

</body>

</html>

<script>

window.onload=function()

{

var btn=document.getElementById("btn");

var txt=document.getElementById("txt");

btn.onclick=function()

{

/*

this.type="text";

input的type属性不能改

IE6,7,8不兼容

*/

this.style.display="none";

txt.style.display="block";

}

}


</script>


0 0
原创粉丝点击