Jump to content

Exchange Blog Cryptocurrency Blog


All Pips



Creating Dynamic Buttons


Recommended Posts

JavaScript button dynamic effects are created using images. The JavaScript button requires three images for the different stages. So to use this example create three images img1.jpg, img2.jpg and img3.jpg (each having different look of button). Copy the code below and save into a file with .htm extension. Now open the file in your browser. Moving mouse over the button will change the image and pressing mouse button will change it again.

 

Make three images representing different states of button img1.jpg img2.jpg and img3.jpg then store the code into a file with .htm extension, open the file in your browser.

 

<a href="http://www.digitalmoneytalk.com/"

onMouseOver="return changeImg()"

onMouseOut= "return changeImgBack()"

onMouseDown="return handleMDown()"

onMouseUp="return handleMUp()"

><img

name="btn" src="img1.jpg" width="110" height="28" border="0"

alt="javascript button"></a>

 

<script language="JavaScript">

 

 

function changeImg()

{

document.images["btn"].src= "img1.jpg";

return true;

}

function changeImgBack()

{

document.images["btn"].src = "img3.jpg";

return true;

}

function handleMDown()

{

document.images["btn"].src = "img2.jpg";

return true;

}

function handleMUp()

{

changeImg();

return true;

}

</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...