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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onfocus and onblur events syntax to change background color

Status
Not open for further replies.

BeeDeeBee

Programmer
Dec 18, 2000
5
US
In VBScript, I am trying to use onfocus to change the background color of a form field named T1 to green, Then onblur to change it back to white. It's simple in VB, but I keep getting an 'Object Required : T1' error in VBScript. I can put a MsgBox in the Sub and it'll work fine.


sub T1_onfocus()
msgBox "Hello" 'Works fine
'(Now, how can I change the background color of the field?)
end sub
sub T1_onblur()
set T1.bgcolor="#FFFFFF"
end sub
 
Hi

Here's the code
Code:
sub T1_onblur()
T1.style.backgroundColor = "white" 'you can use FFFFFF if you want
end sub
sub T1_onfocus()
T1.style.backgroundColor = "green"
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top