用js修改input的value值
<input type="text" value="3" id="txtTest" />
<input type="button" value="aaa" onclick="test();" />function test()
{
document.getElementById("txtTest").value="111";
}ie下页面显示修改成功,看html代码也是修改之后的
修改之前代码是<input type="text" value="3" id="txtTest" />
修改之后代码是<input type="text" value="111" id="txtTest" />
ff下页面显示修改成功,看html代码却是没修改
修改之前代码是<input type="text" value="3" id="txtTest" />
修改之后代码仍然是<input type="text" value="3" id="txtTest" />
但是页面显示的却是111求解
<input type="text" value="3" id="txtTest" />
<input type="button" value="aaa" onclick="test();" />function test()
{
document.getElementById("txtTest").value="111";
}ie下页面显示修改成功,看html代码也是修改之后的
修改之前代码是<input type="text" value="3" id="txtTest" />
修改之后代码是<input type="text" value="111" id="txtTest" />
ff下页面显示修改成功,看html代码却是没修改
修改之前代码是<input type="text" value="3" id="txtTest" />
修改之后代码仍然是<input type="text" value="3" id="txtTest" />
但是页面显示的却是111求解
解决方案 »
- MVC3 如何使用两种validation
- 网站收录代码
- sql求和
- 外国服务器后台上传图片文件时,为什么会要求上传到程序中没有设定的路径
- 急:一个atlas问题,请各位高手指点小弟,谢谢大家......
- 想用.net做点东西,用2003还是2005 express好些?2005express会不会有什么限制?
- 我想学用IEWebControls,可现在没有WebControls.dll。怎么办啊?
- 再次请教一个 获取存储过程输出参数的返回值的问题,请各位高手指教。散分!
- asp.net截取字符串问题
- aspnetmenu URL地址指向问题,100分送上
- config中配置url重写问题,来有经验的啊
- ASP.NET 母版页弹出对话框
如何能让它在实际中也修改了?
我指的是html也变化了?
孟老大多指教
<input id="m" value="初始值">
</div>
<input type=button onclick="document.getElementById('m').setAttribute('value','修改的值')" value="修改">
<input type=button onclick="alert(document.getElementById('d').innerHTML)" value="得到系修改的">
原来IE是直接修改的。一直到现在到没注意过,因为一直以为HTML源码 并不真正修改的
唉 其实setAttribute这个方法 做过web的可能都知道
可是能不能想起来、能不能学以致用
这就是我和孟老大的差距了
1.根据万恶提供的代码设置成匿名登录,IE下失效;
2.个人对评论框等的CSS修饰,成http://img1.douban.com/view/photo/photo/public/p1338887474.jpg这个模样;
3.我希望可以在地址下面的<input />写入“可以不填”;
4.代码如下:
<form onsubmit="return check_cmt(this);" action="http://blog.home.blogbus.com/front/5685717/comments/181345013/item" name="cform" method="post" target="_self">
<fieldset id="fs_nologin" style="margin: 0pt; padding: 0pt; border: medium none; display: block;">
<div><label for="cname">姓 名</label>
<input type="text" name="cname" id="cname" class="textField">
<span class="emailnotice" style="color:#ccc;margin-left:5px;"><a onclick="return login_mode();" style="text-decoration:underline;" title="登录后评论" href="#">登录后评论</a></span></div>
<div><label for="cemail">E-Mail</label><input type="text" name="email" id="cemail" class="textField">
<span class="emailnotice" style="color:#ccc;margin-left:5px;">您将收到博主的回复邮件</span>
</div>
<div><label for="chomepage">地 址</label><input type="text" name="homepage" id="chomepage" class="textField"></div>
</fieldset>
<fieldset id="fs_login" style="margin: 0pt; padding: 0pt; border: medium none; display: none;">
<div><label for="username">用户名</label><input type="text" tabindex="1" name="username" id="username" class="textField">
<span class="emailnotice" style="color:#ccc;margin-left:5px;"><a onclick="return anoy_mode();" style="text-decoration:underline;" title="匿名评论" href="#">匿名评论</a></span></div>
<div><label for="password">密 码</label><input type="password" tabindex="2" value="" name="password" id="password" class="textField"></div>
</fieldset>
<div><textarea tabindex="3" rows="8" name="content"></textarea></div>
<div class="submit">
<input type="hidden" value="0" name="login">
<input type="hidden" value="181345013" name="postId">
<input type="hidden" value="5685717" name="blogId">
<input type="hidden" value="2d31b878fe17816l73b06f4f5637cfb3" name="checksum">
<input type="hidden" value="" name="name">
<table>
<tbody><tr>
<td><input type="submit" id="submit_comment" value="提交" name="addsub" class="button"></td>
<td id="share_check" style="display: none;"></td>
</tr>
</tbody></table>
</div>
</form>
我对它的重要CSS修改代码:#fs_nologin{display:block;float:right;}
#fs_nologin .emailnotice{ display: none;}
5.这个是日志页的地址:
http://h-blogs.blogbus.com/logs/181479335.html