如何用javascript给输入框赋值,我写错了吗?
---html代码如下,我只要给 用户名输入框 和密码框 用JAVASCRIPT写入代码就可以了<form action="login.php?" method="post" name="login">
<input type="hidden" value="" name="forward" />
<input type="hidden" value="http://www. name="jumpurl" />
<input type="hidden" value="2" name="step" />
<div class="cc p10 regItem">
<dl class="cc">
<dt onclick="document.login.pwuser.focus();">
<label for="check0" class="mr10"><input type="radio" id="check0" name="lgt" value="0" checked />用户名</label>
<label for="check1" class="mr10"><input type="radio" id="check1" name="lgt" value="1" />UID</label>
<label for="check2" class="mr10"><input type="radio" id="check2" name="lgt" value="2" />Email</label>
</dt>
<dd><input class="input mr10" type="text" maxLength="60" name="pwuser" size="40" tabindex="2" /><a href="register.php">马上注册</a>
</dd>
</dl>
<dl class="cc">
<dt>密 码</dt>
<dd><input class="input mr10" type="password" maxLength="20" name="pwpwd" size="40" tabindex="3" /><a href="sendpwd.php" target="_blank">找回密码</a></dd>
</dl>
<dl class="cc">
<dt>您的答案</dt>
<dd><input type="text" name="answer" class="input" size="40" tabindex="6" /> <span class="gray">如果您设置了安全问题,需要填写正确的答案才能登录站点</span></dd>
</dl>
<dl class="cc">
<dt>隐身登录</dt>
<dd><label for="hideid1" class="mr20"><input id="hideid1" name="hideid" type="radio" value="1" />开启</label><label for="hideid0"><input name="hideid" id="hideid0" type="radio" value="0" checked tabindex="8" />关闭</label></dd>
</dl>
<dl class="cc">
<dt> </dt>
<dd><span class="btn"><span><button type="submit" name="submit">登录</button></span></span></dd>
</dl>
</div>
</form>
--------------------下面是自动输入用户名的写法--- 可是多显示[object]为空错误----
<script language="JavaScript">
webBrowser.executeJavascript("document.getElementsByName('pwuser').value='99999999999999';");
</script>
<script language="JavaScript">
webBrowser.executeJavascript("document.getElementsByName('pwuser')[0].value='99999999999999';");
</script>