这是练习的代码,居然错了不知道错哪了,请您给改一下,我在线,如果给我教明白了,立即给分,<html>
<body>
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(document.body.tb1);">
<script>
function toUpperCase(obj)
{
var c = document.getElementById(obj).value;document.getElementById("tb1").value=c.toUpperCase();}
</script>
</body>
</html>
<body>
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(document.body.tb1);">
<script>
function toUpperCase(obj)
{
var c = document.getElementById(obj).value;document.getElementById("tb1").value=c.toUpperCase();}
</script>
</body>
</html>
解决方案 »
- MVC 3 Razor 语法问题
- asp.net
- 无状态窗体相克?(都来看看,重在参与)
- 我想把服务器的一个文件的内容在浏览器里输出~~老师帮我看一下是什么地方错了
- 怎样读取dataset里面的数据阿
- 点击button后不刷新页面怎么做?
- asp.net中如何把查出来在显示在DATAGRID中的内容成批全部插入到另一个库中?
- 这个字段为什么不能显示出来?
- 问个菜鸟问题----有关密码框!
- VS.net里边怎么给文字加css样式?
- 关于MSMQ的信息发送问题,亟待解决,希望高手指点,谢谢!
- [巨难问题] OleDbType 没有 Cursor 类型,怎么通过 OLEDB 返回存储过程的游标值??? -------------------------------------> 人工拉长
{
var c = obj.value; //obj是对象document.getElementById("tb1").value=c.toUpperCase(); }
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(this);" >
<script >
function toUpperCase(obj)
{
var c = obj.value; document.getElementById("tb1").value=c.toUpperCase(); }
</script >
</body >
</html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(this);" >
<script >
function toUpperCase(obj)
{
var c = obj.value;document.getElementById("tb1").value=c.toUpperCase();}
</script >
</body >
</html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(this);" >
<script language="javascript">
function toUpperCase(obj)
{
obj.value=obj.value.toUpperCase();
}
</script >
</body >
</html >this就是只tb1这个控件本身
<html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase('tb1');" >
<script >
function toUpperCase(obj)
{
var c = document.getElementById(obj).value; document.getElementById("tb1").value=c.toUpperCase(); }
</script >
</body >
</html >要正规的话:<html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase(this);" >
<script >
function toUpperCase(obj)
{
var c = obj.value; document.getElementById("tb1").value=c.toUpperCase(); }
</script >
</body >
</html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase();" >
<script >
function toUpperCase(obj)
{
var c = obj.value; document.getElementById("tb1").value=c.toUpperCase(); }
</script >
</body >
</html >
ltmltm123456你说你的代码可以不用this,上面的就没有用,不好使啊,哪错了,为什么呢??
<html >
<body >
<input type="text" id="tb1" style="text-align:right;" onblur="toUpperCase();" >
<script >
function toUpperCase()
{
var c = document.getElementById("tb1").value; document.getElementById("tb1").value=c.toUpperCase(); }
</script >
</body >
</html >
document.getElementById("tb1")中的参数要用对象的id,而不是整个对象,在这里,id只是对象的一个属性。