标题:如何用javascript给输入框赋值,我写错了吗?
只看楼主
cixi2010
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2009-2-16
结帖率:100%
已结贴  问题点数:1 回复次数:2 
如何用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>&nbsp;</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>
搜索更多相关主题的帖子: 输入 javascript 赋值 
2010-09-16 14:37
zmh886
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:238
专家分:1305
注 册:2010-6-2
得分:0 

<script language="JavaScript">
  document.getElementsByName('pwuser')[0].value='99999999999999';
</script>

http://www./
2010-09-16 16:22
chenyu329134
Rank: 2
等 级:论坛游民
帖 子:36
专家分:21
注 册:2010-9-17
得分:0 
已经有<script> 标签了  就不需要再写 webBrowser.executeJavascript
2010-09-17 13:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-320586-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.156990 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved