PDA

View Full Version : Loading a page from a onMouseOver



nojo
07-25-2008, 05:59 PM
ok iv been trolling these forums... and the internet in general and im at a loss on how to do this.

I need to load a page from a mouseover(i know it sounds dirty) and i need it still to function as a link to another page.

IE i need something like this:

<a href="linkclickablepage.php" onmouseover="ajaxpage('v3info.php', 'Content');">XW Version 3</a>

this is the page im working on http://www.fivon.net/

Im trying to turn the version3 and version4 buttons below the actual content area into a mouseover to load content into the frame above, so that they have an idea about what that version is before they click on the link and load the game.

Any help would be great! I realize i talk in circles some times so if you need me to clear up what im trying to do just post.

Thanks in advance!

Dal
07-26-2008, 03:29 AM
Why do you need to use ajax for changing the content of a single box? Thats kind of using a lawn-mower engine for a chainsaw (Not too overboard but still unneccessary).


//head tag
var DefaultTxt = "It's 2012, a world filled with terror, devastated by...";
var AboutVer2 = "Hi this is the block if information about ver2...";
var AboutVer3 = "Hi this is the block if information about ver2...";

function AdjustContent(To){

if(To == "Ver3") divelement.innerHTML = AboutVer3;
else if(To == "Ver2") divelement.innerHTML = AboutVer2;
else if(To == "Default") divelement.innerHTML = DefaultTxt;
}
//head tag

a href="link.php" onmouseover="AdjustContent('Ver3');" onmouseout="AdjustContent('Default');">...


Untested but Im sure you will have no problem working with this.

Kind regards
Dal

nojo
07-26-2008, 01:20 PM
thanks for the reply Dal! Your code doesnt seem to be working for me. Forgive me im not very fluent in Javascript so i could be missing something simple.

Im placing the header information in its script tags and then im putting the link on the page but on IE and Firefox they both do nothing.

now does it make a difference that im trying to point this to an iframe?



<iframe id="xwcontent" name="Content" src="gamedesc.php" frameborder="0" vspace="0" hspace="0" marginwidth="0"
marginheight="0" width="458" scrolling=NO height="165" allowtransparency="true"
style="Z-INDEX: 999; LEFT: 117px; POSITION: absolute; TOP: 272px; visibility:100%; filter: chroma(color="#FFFFFF");"></iframe>


also... i already have the content on their own pages, i understand that you just put the info in vars which is cool but would it be possible to direct them towards:

v3info.php
v4info.php
gamedesc.php

instead?

Thanks in advance and im sorry for being such a layman when it comes to javascript

jscheuer1
07-26-2008, 01:42 PM
There is no function ajaxpage() on your demo page.

If you mean this script:

http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

It should work (it would need to be on a live page to work in IE 7), but you should post in the Dynamic Drive Scripts Help section and let people know what script you are using. Don't worry this time though, I'll move the thread if I decide that's where it belongs.

In any case, we cannot troubleshoot your page if it doesn't have the code on it that you are asking about.

Dal
07-26-2008, 02:52 PM
when I gave you the "divelement" object I hadnt set that up;

divelement = document.getElementById('yourelementid');

put this inside the function I created for you at the top. Im not sure about iFrames as Ive avoided them since lots of people seem to think that they are bad. I always concentrate on the mose W3c and google friendly way of doing things and although iframes may pass the criteria (unsure) Ive never actually had any reason to use them.

Hope this helps :)
Kind regards
Dal