Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-01-2010, 12:09 PM   #1
Daemon Poster
 
Join Date: May 2009
Posts: 690
Default JAVA help

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?????????
__________________

biferi is offline   Reply With Quote
Old 03-01-2010, 01:45 PM   #2
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: JAVA help

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.
berry120 is offline   Reply With Quote
Old 03-01-2010, 01:53 PM   #3
Daemon Poster
 
Join Date: May 2009
Posts: 690
Default Re: JAVA help

Everything I saw told me you have to know Java.

How do you do this???
biferi is offline   Reply With Quote
Old 03-01-2010, 02:06 PM   #4
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: JAVA help

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.
berry120 is offline   Reply With Quote
Old 03-01-2010, 04:02 PM   #5
Daemon Poster
 
Join Date: May 2009
Posts: 690
Default Re: JAVA help

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?
biferi is offline   Reply With Quote
Old 03-01-2010, 04:29 PM   #6
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: JAVA help

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.
berry120 is offline   Reply With Quote
Old 03-02-2010, 09:30 AM   #7
In Runtime
 
Join Date: Jan 2010
Posts: 320
Default Re: JAVA help

<b> BERRY FTW </b>
Luke_Uk_Baggy is offline   Reply With Quote
Old 03-03-2010, 03:13 PM   #8
In Runtime
 
hockeygoalie5's Avatar
 
Join Date: Dec 2009
Location: United States
Posts: 297
Default Re: JAVA help

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>
Now look for the tag <body> and change it to:
Code:
<body onload="MM_preloadImages('CHANGE_TO_IMAGE2_NAME.gif')">
Where CHANGE_TO_IMAGE2_NAME is what you want to appear on mouse over.

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()" />
Where CHANGE_TO_IMAGE1_NAME is the name of the image to show originally and CHANGE_TO_IMAGE2_NAME is what will replace image1 on mouse over.

Hope it helps,
hockeygoalie5.
hockeygoalie5 is offline   Reply With Quote
Old 03-04-2010, 02:04 AM   #9
In Runtime
 
ohm55's Avatar
 
Join Date: Feb 2010
Posts: 141
Default Re: JAVA help

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?
ohm55 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 09:44 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0