javascript 给text赋值
javascript 给text赋值
方法一:
<!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>
</head>
<body >
<form name="form1" method="post" action="">
<input type="text" id="a" >
<script language="javascript">
document.getElementById("a").value="ssss";
</script>
</form>
</body>
</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">
function inta()
{
document.getElementById("a").value="ssss";
}
</script>
</head>
<body onload="inita();">
<form name="form1" method="post" action="">
<input type="text" id="a" >
</form>
</body>
</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>
</head>
<body >
<form name="form1" method="post" action="">
<input type="text" id="a" >
<script language="javascript">
document.getElementById("a").value="ssss";
</script>
</form>
</body>
</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">
function inta()
{
document.getElementById("a").value="ssss";
}
</script>
</head>
<body onload="inita();">
<form name="form1" method="post" action="">
<input type="text" id="a" >
</form>
</body>
</html>