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!

Button with to states

Status
Not open for further replies.

jamesmay

Technical User
Jun 1, 2004
41
GB
Hi i want to have a button which when pressed calls a javacript funtion, when the button is pressed again it calls a different function. Is it also possible to make the button latch (look like it is stuck down) and change the lable?

Kind regards,
 
This is what i am trying to do (if it helps..)

When i select the button the image on the screen will fade. when i reseled the button the image will unfade.

<script language="JavaScript">
function opacity() {
if (Image).filters.alpha.opacity=30 {
document.getElementById('opacity').value = "Fade Image";
}
else {
(Image).filters.alpha.opacity=100
document.getElementById('HideMenu').value = "Un Fade Image";
}
}
</script>
 
Just figured it out...

<input type="hidden" name="hiddenField" value="null">
<script language="JavaScript">
function resize() {
if (document.getElementById('hiddenField').style.visibility != "hidden") {
document.Image.filters.alpha.opacity=30
document.getElementById('hiddenField').style.visibility = "hidden";
document.getElementById('HideMenu').value = "Unfade Image";

}
else {
document.Image.filters.alpha.opacity=100
document.getElementById('hiddenField').style.visibility = "visible";
document.getElementById('HideMenu').value = "Fade Image";
}
}
</script>

<input type="button" name="HideMenu" value="Fade Image" onClick="resize()" style="WIDTH: 100px">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top