SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 30th, 2008, 09:58 PM
footballer footballer is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 73 footballer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 51 m 55 sec
Reputation Power: 1
Rollover image with onclick problem

Hi,

I simply want this script to when I roll over mouse is changes image, then when I Onclick I want it to go to a different image and stay there but when I take the mouse away it changes back? Any help, i want to be able to click it again then changes back to normal with the normal rollover image etc but once clicked it stays on the clicked image so sorta lke when I Onclick is disables the rollover until I click on the image again,

Code:
<html>
<head>
<title>test</title>
<script language="JavaScript" type="text/JavaScript"> 
var q=0; 
var root='lotto/'; 
function swapImg(ima){ 
nr = ima.getAttribute('src').split('/'); 
nr = nr[nr.length-1].split('.')[0]; 
if(q==0){ima.setAttribute('src',root+nr+'.jpg');q+  +;} 
else{ima.setAttribute('src',root+nr+'.gif');q--;} 
} 
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//-->
</script>
<script language="JavaScript" type="text/JavaScript">

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

</script>
</head>
<body>

<div align="center"><a onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('no01','','lotto/01_over.gif',1)"><img src="lotto/01.gif" name="no01" width="40" height="40" border="0" onclick="swapImg(this)"></a>

</body>
</html>

Reply With Quote
  #2  
Old April 1st, 2008, 11:58 AM
DanDaBeginner DanDaBeginner is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Philippines
Posts: 331 DanDaBeginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 26 m 9 sec
Reputation Power: 2
how about:
Code:
 
function swapImg(ima){ 
   ima.src = 'myimage.jpg';
} 
__________________
my dreams are coming true...

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Rollover image with onclick problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway