|
|
#1 |
|
Daemon Poster
Join Date: May 2009
Posts: 690
|
I am trying to do Rollover images for my web page and need some hlp.
I know you need 2. images the same but a little diferant. And on image is say called ballON.gif and the other image is called ballOOF.gif And you use the basic code to place the one image on the page and you would use the basic code to make that image a Link to the page you want to link to. I get this I do that all thwe time. And the secound image you do the same thing to. Now it is the Java code that will make everything work togather. Am I right so far?????? So this is how I have everything setup all my HTML files and Photos and everything for my web site is in the same Folder. So what would the whole code be for if I wanted to make Rollover image ballON.gif and ballOFF.gif And I want it to link to the index.HTML page wen the mouse is over it????????? |
|
|
|
|
|
#2 |
|
Site Team
Join Date: Jul 2009
Posts: 2,627
|
Sorry, but I'm struggling to see what on earth this has to do with Java?!
__________________
Save the whales, feed the hungry, free the mallocs. |
|
|
|
|
|
#3 |
|
Daemon Poster
Join Date: May 2009
Posts: 690
|
Everything I saw told me you have to know Java.
How do you do this??? |
|
|
|
|
|
#4 |
|
Site Team
Join Date: Jul 2009
Posts: 2,627
|
Sounds like you're confusing Java with Javascript. The two are VERY different - Java has absolutely nothing to do with this. Google around if you're still confused and you'll very quickly find out what the differences are!
Either way, you don't need Javascript either these days - you can do it through CSS (which is a much better alternative.) Have a look here for an example: http://www.tutorio.com/tutorial/pure...mage-rollovers
__________________
Save the whales, feed the hungry, free the mallocs. |
|
|
|
|
|
#5 |
|
Daemon Poster
Join Date: May 2009
Posts: 690
|
Thanks but do you think you could tell me or show me an easyer link to do this?
I did get a litle mor confused? |
|
|
|
|
|
#6 |
|
Site Team
Join Date: Jul 2009
Posts: 2,627
|
Sorry - but this time I'm going to be firm and say no, I'm not going to go and search Google and find an article that tells you exactly what to do and how to do it. I can't remember a single time here when you've gone away and done something because of an answer here, all the times I've remembered you've just asked for an easier way to do it that involves no effort on your part whatsoever.
If you've TRIED things and failed, or only got half way there then fair enough. I'm all up for helping people who put the effort in but genuinely struggle for whatever reason. But you haven't shown any evidence that you've tried to do the above - and since you've been asking basic web questions on here for a while now, I don't think it's too much to expect you to have gone away and done at least a bit of research. The last resource I'm going to point you at for now is this one. Head over to there and follow through the tutorials on HTML, XHTML (which you should really be using over HTML these days) then CSS. Once you've done that, move onto Javascript, PHP and SQL as well if you like. Study them carefully, work through the examples and code some basic things yourself, without just copying and pasting from the site. Try different things out, understand how they work together and make sure you're fully conversant with one stage before moving onto the next. It's not something that will come instantly - but that's something you need to accept. If everything in the computing world was simple, straightforward and came to people straight away then I wouldn't still be learning things after a decade or so. You've got to the point now where you need to stop searching for an "easier" way to do everything and start accepting the standard way of doing things. If you follow the above tutorials through and understand them fully, implementing the various examples people have pointed you towards (including the one in this thread) will be an absolute piece of cake - and that's assuming you need them at all! Specific questions on various points or concepts you're struggling with are completely understandable. Post something querying why your javascript is preventing your XHTML from validating for example and I'll be happy to answer. Just asking people to do things for you though won't get you anywhere.
__________________
Save the whales, feed the hungry, free the mallocs. |
|
|
|
|
|
#7 |
|
In Runtime
Join Date: Jan 2010
Posts: 320
|
<b> BERRY FTW </b>
|
|
|
|
|
|
#8 |
|
In Runtime
|
Berry is correct, this requires JavaScript rather than Java. I believe what's below is exactly what you want.
Place within the <head></head> tags: Code:
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
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_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;
}
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>
Code:
<body onload="MM_preloadImages('CHANGE_TO_IMAGE2_NAME.gif')">
Finally the image: Code:
<img src="CHANGE_TO_IMAGE1_NAME.gif" width="250" height="200" id="Image1" onmouseover="MM_swapImage('Image1','','CHANGE_TO_IMAGE2_NAME.gif',1)" onmouseout="MM_swapImgRestore()" />
Hope it helps, hockeygoalie5. |
|
|
|
|
|
#9 |
|
In Runtime
Join Date: Feb 2010
Posts: 141
|
My god, berry. That was great.
__________________
You are such a good friend that if you and me were the last two people trapped on a sinking boat with only 1 life vest left, i would remember and pray for you every day. Funny how Communism is so bad in Politics but so good with software! My reputation is in the Red, so why doesnt it say "ohm55 needs rehab" when I put my mouse over it? |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|