PDA

Click to See Complete Forum and Search --> : Oh Dear...Button Properties problem


alex_read
Oct 5th, 2000, 08:41 AM
Back once again...

<TR><INPUT TYPE="button" NAME="About" VALUE="ABOUT ME" _
STYLE="HEIGHT:35px; WIDTH:120px; BORDER:0; _
BACKGROUND=Transparent" TR<>

is one of my tabel columns (I know this bit is correct). I then have a VBScript code using the About_OnMouseMove property to make a change to this. If I use the :

Private Sub About_OnMouseMove
Document.Frm_MenusLeft.About.Value = "I've Been Changed!"
End Sub

this works! :confused: However, if I call some of the other properties, which were recognised as working when the page loads, there is an error - the end part is not recognised :( :


Private Sub About_OnMouseMove
Document.Frm_MenusLeft.About.STYLE="HEIGHT:50px; _
WIDTH:150px; BORDER:1; BACKGROUND=LightYellow"
End Sub


Can someone please tell me why this is playing up? :Confused:
Thank you in advance!

[Edited by alex_read on 10-05-2000 at 09:44 AM]

monte96
Oct 5th, 2000, 09:57 AM
Ok... first off, you need a TD tag in your table. The browser is still displaying it without errors because they are designed to do a "best guess" as to what was intended with unclosed tags and missing tags but no data belongs inside of a TR tag alone. TR tags only define the row not the data in the row (in this case your INPUT tag).

Second, the underscore is very handy in VB and VBScript, but not in the middle of a quoted string like you have here:


Private Sub About_OnMouseMove
Document.Frm_MenusLeft.About.STYLE="HEIGHT:50px; _
WIDTH:150px; BORDER:1; BACKGROUND=LightYellow"
End Sub


and third (and most importantly) you can't assign an inline style like that in script. Only through the Style attribute.

Good news is, you can do what you are trying to do like this:


Sub About_OnMouseMove
Frm_MenusLeft.About.style.height = "50px"
Frm_MenusLeft.About.style.width = "150px"
Frm_MenusLeft.About.style.border = 1
Frm_MenusLeft.About.style.background = "LightYellow"
End Sub

'Probably want to add this to return it to normal when the mouse moves away:
Sub About_OnMouseOut
Frm_MenusLeft.About.style.height = "35px"
Frm_MenusLeft.About.style.width = "120px"
Frm_MenusLeft.About.style.border = 0
Frm_MenusLeft.About.style.background = "Transparent"
End Sub