ASP:带有onfous的TEXTBOX和带有javascript的onblur [英] ASP:TEXTBOX with onfous and onblur with javascript

查看:68
本文介绍了ASP:带有onfous的TEXTBOX和带有javascript的onblur的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的HTML代码

这是一个文本框字段,当您单击它时,它将取出";姓氏"写在框中,当您在框外单击时,它将再次具有姓氏"字样.写在框中.

I have an HTML code like this

This is a textbox field when u click on it it will takeout the "Last Name" written in the box and when u click outside the box it will again have "last Name" written in the box.

 

< 输入 =文本" ="col2" =""*姓氏" ="test (this);" />

功能

<input type="text" class="col2" value="*Last Name" onfocus="test(this);" onblur="test(this);" />

function

test(obj){
如果 (obj.value == '' ;
obj.first =
;
}
{
obj.Val =
;
}
}
else 如果
;
obj.first =
'true' ;
}}

我想用asp文本框替换输入文本
但是我没有得到与输入类型文本一起使用的相同的Javacript功能.

我们可以用文本框来覆盖onfocus和onblur并让它们运行javacript吗?
我不确定该怎么做?

test(obj) {
if(obj.Val) {
if (obj.value == '') {
obj.value = obj.Val;
obj.Val =
null;
obj.first =
null;
}
else {
obj.Val =
null;
}
}
 
else if (!obj.first) {
obj.Val = obj.value;
obj.value =
'';
obj.first =
'true';
} }

I want to replace the input text with asp textbox
but I am not getting the same javacript feature which i am using with input type text.

Can we hadd the onfocus and onblur with textbox and have them run the javacript.
I am not sure how can we do that?

推荐答案

你好,

感谢您的发帖!我建议将您的问题发布到

Thank you for your post!  I would suggest posting your question in

http://forums.asp.net/

MSDN>论坛首页> .NET开发位于此处:

MSDN > Forums Home > .NET Development  located here: 

http://social.msdn. microsoft.com/Forums/zh-CN/category/netdevelopment

希望有帮助.

祝你有美好的一天!


这篇关于ASP:带有onfous的TEXTBOX和带有javascript的onblur的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆