一道关于ONCHANGE的题 <Script><!--function b1(){document.form[0].element[0].value.toUpperCase();}--></Script> </head> <body> <form name="form1"> <input type="text" name="txt" value="sample" onChange="b1()"> </form> </body>怎么sample不能变成大写呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head> <Script><!--function b1(){document.forms[0].elements[0].value=document.forms[0].elements[0].value.toUpperCase();}--></Script> </head> <body> <form name="form1"> <input type="text" name="txt" value="sample" onchange="b1()"> </form> </body></html>楼主错的地方他多了,可以试试这个。 <input type="text" name="txt" id="txt" value="sample">jquery写法$("#txt").change(function(){ $(this).attr("value",$(this).val().toUpperCase());});去学学jquery,用起来蛮方便的!~ 楼主这个功能不需要涉及到JS<input type="text" name="txt" value="sample" style="text-transform:uppercase">直接用这个文本框就可以了 JS获取当前时间,截取年份 A标签跳转后样式问题!!!!!急, 请问谁有个建议或者想法,最好当然是代码了 这年头连csdn的账号也会丢 JQ选择器问题 未将对象引用设置到对象的实例 帮我看看下面程序有什么错误啊,怎么调试啊 如何判断窗口是否打开?不是父子窗口。 [50分求助] 关于路径变换的问题,很苦恼~~ Js向flex传值,出现undefined is not a function textarea 中如何显示HTML代码 firefox 如何捕获关闭事件
<html>
<head>
<Script>
<!--
function b1(){document.forms[0].elements[0].value=document.forms[0].elements[0].value.toUpperCase();}-->
</Script>
</head>
<body>
<form name="form1">
<input type="text" name="txt" value="sample" onchange="b1()"> </form>
</body>
</html>
楼主错的地方他多了,可以试试这个。
$("#txt").change(function(){
$(this).attr("value",$(this).val().toUpperCase());
});
去学学jquery,用起来蛮方便的!~
楼主这个功能不需要涉及到JS
<input type="text" name="txt" value="sample" style="text-transform:uppercase">
直接用这个文本框就可以了