Results 1 to 5 of 5

Thread: Loading a page from a onMouseOver

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Loading a page from a onMouseOver

    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!

  2. #2
    Join Date
    Jul 2008
    Posts
    102
    Thanks
    36
    Thanked 6 Times in 6 Posts

    Default

    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).
    Code:
    //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
    Programmers are tools used to convert Caffeine to code

  3. The Following User Says Thank You to Dal For This Useful Post:

    nojo (07-26-2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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?

    Code:
    <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

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is no function ajaxpage() on your demo page.

    If you mean this script:

    http://www.dynamicdrive.com/dynamici...jaxcontent.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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Dal (07-26-2008)

  7. #5
    Join Date
    Jul 2008
    Posts
    102
    Thanks
    36
    Thanked 6 Times in 6 Posts

    Default

    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
    Programmers are tools used to convert Caffeine to code

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •