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

Mousedownevent 1

Status
Not open for further replies.

misslilbit02

Programmer
Jun 25, 2005
8
0
0
US
Hi,

I'm trying to do sort of like a thumbnail and dynamically show the picture thingy. I'm using the onmousedown event but I want to be able to have a default image appear. Can someone help me with my current code or give a totally new concept as to do what I want. You can view this example at
<IMG SRC="html/images/tshirt-button_02.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/rednwhcapsleeve-ETHB.gif'">
<IMG SRC="html/images/tshirt-button_04.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/gr-ETTHB.gif'">
<IMG SRC="html/images/tshirt-button_05.gif" ALT=" " ONMOUSEdown="document.images['large'].src='html/images/blu-ringer-ETTHB2.gif'">
<IMG SRC="html/images/tshirt-button_06.gif" ALT=" " ONMOUSEdown="document.images['large'].src=''">
<BR><BR>
<IMG SRC="html/images/spacer.gif" ALT=" " NAME="large">

Thanks a million
 

Try using onclick="..." instead.

Hope that does what you want!

Jeff

 
Code:
ONMOUSEdown="[red]document.images['large'].src='html/images/blu-ringer-ETTHB2.gif[/red]'

I think that will work if the image is preloaded into the images collection. preload 'html/images/blu-ringer-ETTHB2.gif'. then try again.

Code:
<script language="JavaScript" type="text/JavaScript">
<!--
 function Preload() {
 	var args = simplePreload.arguments;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++) {
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
   }
 -->
 </script>

---------------------------
WORD OR VOTE TO THE WISE IS ENUFF...;)
 
I don't think I'm sure about what you are saying. How should I set this up.

<script language="JavaScript" type="text/JavaScript">
<!--
function Preload() {
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++) {
document.imageArray = new Image;
document.imageArray.src = args;
}
}
-->
</script>


<body onLoad = "Preload();">


And then what should I do...do the mouse down event code.




 
use this in the head to preload the images for roll over effects,.

Code:
<script language="JavaScript" type="text/JavaScript">
<!--
 Preload = function (path)
    {
     var imgO = new image();
     imgO.src = path;
     return imgO;
    }

pic_1 = Preload('html/images/rednwhcapsleeve-ETHB.gif');
 -->
</script>

---------------------------
WORD OR VOTE TO THE WISE IS ENUFF...;)
 
This in the body
Code:
<IMG SRC="html/images/tshirt-button_02.gif" ALT=" " ONMOUSEdown="this.src = pic_1.src">

---------------------------
WORD OR VOTE TO THE WISE IS ENUFF...;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top