Log in

View Full Version : help, javascript problem



Chris33
08-27-2005, 06:08 PM
I trying to use simple javascript to launch a page into an inline frame. the script I have so far runs thus:

<script>
function loadhometitle() {
frames['titleframe'].location.href='http://www.hotmail.com'; return false;

}
</script>


the event handler being <a onclick="loadhometitle()" ...................



the problem is that hotmail doesn't load into the iframe but the whole page; or atleast it appears to begin to load into the iframe then simply takes up the whole page.


I have also tried : parent.frames[titleframe].location = 'http://www.hotmail.com'


any solutions have to be in javascript

please help!

thanks

Chris

jscheuer1
08-27-2005, 06:14 PM
You don't need a script for that. If the link is on the parent page:

<a href="www.hotmail.com" target="titleframe">Hot Mail</a>or, if the link is already in the iframe:

<a href="www.hotmail.com">Hot Mail</a>BUT, if hotmail.com has code on their page(s) to break out of frames, there is no method that will prevent that from happening other than turning off javascrpt on your browser.

Chris33
08-27-2005, 07:35 PM
Thanks for the reply but I can't use the straight forward <a href= ></a> tags. What i've done on my site is assemble a series of buttons with a special dissolving rollover effect on them, in order to do this I had to specify onmouseover and onmouseout codes, plus these buttons are all hyperlinked. I have tried repeatedly to slip some code into the existing <a> tags but to no avail, in fact the rollover effect even stopped working, thus I need to use javascript and an event handler.


suggestions please

Chris33
08-27-2005, 07:38 PM
no wait...you genius....you were right, the problem is simply because stinking hotmail.com wouldn't stay within the iframe......never use hotmail as a test page :-)

thanks alot

chris