Skip to content

Instantly share code, notes, and snippets.

@robertjwhitney
Created September 18, 2008 18:07
Show Gist options
  • Save robertjwhitney/11452 to your computer and use it in GitHub Desktop.
Save robertjwhitney/11452 to your computer and use it in GitHub Desktop.
if (document.images) {
var button1_up = new Image();
button1_up.src = "collapse.gif";
var button1_down = new Image();
button1_down.src = "expand.gif";
}
function switchButton1() {
if (document["button1"].src == button1_down.src) {
document["button1"].src = button1_up.src
} else {
document["button1"].src = button1_down.src
}
}
<html>
<head>
<script type="text/javascript" src=ImageToggle.js">
</head>
<body>
<a href="#" onmousedown="switchButton1('button1'); return false;><img src="img/expand_btn.gif" id="button1" name="button1"/></a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment