View Full Version : Loading a page from a onMouseOver

08-18-2006, 04:07 AM
Hey guys,

I am trying to figure out how to make a page load from a onMouseOver button on a menu bar on the left hand side of the screen to a container that i have named "content."

i am working with the code found on this page:


I drew a picture to better illustrate my point. Here's the picture:


I basically made a background in Adobe Photoshop and have pieced it into two pieces. The top half of the image is inside the container dubbed "head," while the menu side of the webpage is inside the container dubbed "left." Now, comes the tricky part. I have made buttons that i wish to have a rollOver effect that are inside the container "left."

I finally have the rollOver effect working perfectly, but i cannot figure out how to apply the ajax code of loading webpages (from one container to another) to this rollOver function.

So, my question is this:

Can I apply the Ajax code above (the link at the top) to my rollOver images? I want to load the appropriate webpage (by clicking on the rollOver image) into the container i have dubbed "content" from those buttons.

Hopefully, this all makes sense. Thanks for the help everyone!


08-18-2006, 04:12 AM
Ohhh, i forgot to mention that I need to post more of my code, let me know and i'll get on it right away!

Thanks again!

-the cletus

08-18-2006, 04:51 AM
Hmm.. This may help:

<a href="http://" onmouseover="click()" target="framename">Link Name</a>

08-18-2006, 12:27 PM
um, try this <a href="#" onmouseover="ajaxpage('test.htm', 'content');">test</a>

08-18-2006, 02:06 PM
First you would have to make the function "ajaxpage"

08-18-2006, 03:40 PM
Ohhh, you know. I'm sorry guys.

Now that i read my post, I didn't make it clear that I wanted the page to load from the rollOver image into the container "content" until the user CLICKED the image.

I'm sooooo sorry.

So, whent he user clicks the rollOver image, that's when i want the page to load. Oops!

Thanks for the help. I understand the code you wrote above. The onMouseOver link is kinda cool and I am going to use that in another part of my page. But for these rollOver buttons, I want the user to click them for the page to load.


P.S. I took the rollOver javascript from another tutorial and I have found some other code that looks a little less complicated. So, i'll try to experiment with that code for a while. If not, i'm gonna be back here! Thanks everyone!

08-18-2006, 07:01 PM
So, whent he user clicks the rollOver image, that's when i want the page to load. Oops!

Good. Loading content on mouseover is a terrible idea.

Ideally, you wouldn't bother with this at all and simply load a new page like everyone else does; it's simple and it works very nicely. However if not, use an in-line frame (an iframe element). Don't bother with AJAX or other scripted methods: navigation should never depend on client-side scripting.


08-18-2006, 07:33 PM
First you would have to make the function "ajaxpage"
Reread the OP's original post. Click the click. Check the code.:)

As for the original question do it like this.

<a href="javascript:void(ajaxpage('test.htm', 'content'))">You image code</a>

08-19-2006, 05:20 AM
so i now go the code to work. Thanks for all your help guys! You guys rock!

now...for the next bit:

ok, so after reading a couple resources i found on the web and taking some of yall's advice, I think i'm going ot try to redo my site with frames and iframes.

You know, i used to design webpages with frames, but i thought that CSS was the newer way to go, so i decided i would start with that. I am now understanding what CSS exactly does little by little.

I will incorporate what i have learned from these exercises in CSS to frames. It looks like it will be easier on me to start with something i know and build from there. *slaps himself*

I should've started with that, but i thought frames were a thing from the past! haha, boy was i wrong!

Once again, thanks for all your help!

-the cletus

08-19-2006, 04:35 PM
... i thought frames were a thing from the past! haha, boy was i wrong!

They are, which is why I suggested that you should change your design and simply reload the document like everyone else. However, if you are going to continue with it, you might as well use a mechanism that works reliably.