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

RollOver Button 1

Status
Not open for further replies.

66666666

Technical User
Apr 21, 2001
1
CA
Hi Everyone
How can you make a Rollover Button in VBScript that has four functions.
it should do OnMouseOver , OnMouseOut , OnClick and now is the part that i can't find out : once you click the button it should stay to that image untill you click an other button.
here i did the 3 fuctions can someone Please tell me how to do the OnClick stay to he image function?
Thank you in advance

<html>
<Script Language=&quot;VBScript&quot;>
Sub Over()
document.images(0).src=&quot;Home1.bmp&quot;
End Sub

Sub Out()
document.images(0).src=&quot;Home.bmp&quot;
End Sub

Sub BClick()
document.images(0).src=&quot;Home2.bmp&quot;
End Sub
</Script>
<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot;>
<img src=&quot;Home.bmp&quot; OnMouseOver=&quot;Over()&quot; OnMouseOut=&quot;Out()&quot; OnClick=&quot;BClick()&quot;>

</body>
</html>
 
My guess is that you need a flag to be set once they've clicked so that the other functions won't do their thing:

Code:
<Script Language=&quot;VBScript&quot;>
Dim bClicked

 Sub Over()
  If not bBlicked = True Then
      document.images(0).src=&quot;Home1.bmp&quot;
  End If
End Sub

 Sub Out()
  If not bBlicked = True Then
      document.images(0).src=&quot;Home.bmp&quot;
  End If
End Sub

Sub BClick()
  document.images(0).src=&quot;Home2.bmp&quot;
  bClicked = True
End Sub
</Script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top