Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error with ClearText(this) function 1

Status
Not open for further replies.

lorca

Technical User
Dec 20, 2005
64
GB
Hi

I've got 2 input types of text with a value that when clicked the value (set text) clears, except i get an error 'Object expected'
I have to build my asp page up as a string, so excuse that

javascript
Code:
LPRSearchHead1 = "<script language=""JavaScript"" type=""text/javascript"">" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "function clearText(thefield) {" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "if (thefield.defaultValue = thefield.value){" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "thefield.value = """ & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "   }" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "else {" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "thefield.value = thefield.defaultValue" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "}" & VBCRLF
LPRSearchHead1 = LPRSearchHead1 & "}</script>" & VBCRLF

the text box
Code:
LPRSearchBody = LPRSearchBody & "<td width=""60%""><strong><input type=""text"" id=""fp1"" name=""SchTradingName"" size=""35"" value=""Enter Trading Name"" onClick=""clearText(this)"" /></strong></td>"

there are <FORM> and </FORM> tags.

thanks
richard
 
>[tt]LPRSearchHead1 = LPRSearchHead1 & "thefield.value = """ & VBCRLF[/tt]
[tt]LPRSearchHead1 = LPRSearchHead1 & "thefield.value = ""[red]""[/red]" & VBCRLF[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top