这是练习的代码,居然错了不知道错哪了,请您给改一下,我在线,如果给我教明白了,立即给分,<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>
解决方案 »
- 除非指定了 UpdateCommand,否则数据源“SqlDataSource2”不支持更新操作。
- 【微軟公司2008年面試題】
- [求助] FCKEditor文件上传路径问题。
- 请问右键菜单功能能重写吗?
- 使用control.ocx编辑office文件出现的一些问题
- 用户控件的简单问题
- 菜鸟级问题:在前台怎样给数据库增加一条记录
- 急,用window.showModalDialog再次打开窗体时的问题
- asp.net中可以使用带有临时表(#xxx)的存储过程吗?
- 哎!你说奇怪不奇怪。一条这样的语句竞出错?
- 关于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只是对象的一个属性。