...

View Full Version : onClick & onDblClick help needed



____________
05-01-2006, 10:19 PM
Im using this in my web to change menu images OnMouseOver, into common.js:


function roll_images() {
var default_alt_tag_contents= "Pic";
var d=document;
var imgarr = d.getElementsByTagName('img');
if (imgarr.length>0){
var imgOriginSrc; var imgTemp= [];
var ii=imgarr.length;
while ( ii-- ) { e= imgarr[ii];
if (!e.getAttribute('alt')) {e.setAttribute('alt',default_alt_tag_contents)}
if (e.getAttribute('hsrc')) {
imgTemp[ii] = new Image(); imgTemp[ii].src = e.getAttribute('hsrc');
if (d.all) { imgarr[ii].style.display= "block";}
if (d.childNodes && !d.all ) { imgarr[ii].style.overflow= "hidden";}
e.onmouseover = function() {imgOriginSrc=this.getAttribute('src');this.setAttribute('src',this.getAttribute('hsrc'))}
e.onmouseout = function() {this.setAttribute('src',imgOriginSrc)}
}
}
}
}
function addLoadEvent(func) { var oldonload = window.onload;
if (typeof window.onload != 'function') { window.onload = func; }
else { window.onload = function() { oldonload(); func(); }
}}



addLoadEvent(roll_images);
addLoadEvent(function() {

});


And something like this to make it work:


<img src="images/h_news.gif" hsrc="images/h_newsu.gif">

What i need is to use "OnClick" function in other images, i mean i have some icons in the web and i want when user click the image it changes, when he click it again it back to the first one and go to another page when double click. Can someone help me to do this and add it to my common.js? im so bad with javascript.

Thanks for advantage.

____________
05-02-2006, 03:07 AM
I did it using another .js
Thnkx anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum