Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

asp.net javascript textbox

Posted on 2011-10-12
2
Medium Priority
?
278 Views
Last Modified: 2012-05-12
Hello,

I am trying to add javascript onClick and onBlur as textbox attributes from the vb.net script

Its working OK however W3c validator is not recognise these attributes and returning 1 error on the page

>> there is no attribute "onClick"
>> there is no attribute "onBlur"


Please can someone advise if there is any problem in the following

txtSearch.Attributes.Add("onClick", "this.value='';")
txtSearch.Attributes.Add("onBlur", "javascript:if (this.value=='') this.value='Search for...';")

Thanks
0
Comment
Question by:daira
2 Comments
 
LVL 8

Accepted Solution

by:
newbie27 earned 2000 total points
ID: 36955893
Hi

try

txtSearch.Attributes.Add("onclick", "this.value='';")
txtSearch.Attributes.Add("onblur", "javascript:if (this.value=='') this.value='Search for...';")
0
 

Author Closing Comment

by:daira
ID: 36955955
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question