PROnetworks »

Post new topic    Reply to topic
Login to print this topic
Author Message
gries818
PostPosted: Wed Aug 13, 2008 10:41 am Reply with quote

Respected Member
of PROnetworks
 
 


Joined: 07 Jul 2004
Posts: 6562
Is it possible to redirect to a new page in another frame? With straight up HTML tags it's easy:

Code:
<a href="index.html" target="frm_main">title here</a>


However I need to use Javascript to have this same effect because I'm building a query string on an asp file (ie default.asp?id=1) with Javascript and then want to send it along without making a link which I prompt the user to click. lol
 
Back to top
gries818
PostPosted: Wed Aug 13, 2008 11:01 am Reply with quote

Respected Member
of PROnetworks
 
 


Joined: 07 Jul 2004
Posts: 6562
I forgot to mention that I need to redirect into an iframe.
 
Back to top
jbullard
Jason Bullard
PostPosted: Wed Aug 13, 2008 2:03 pm Reply with quote

Vice President
Software
 
 


Joined: 06 Jun 2004
Posts: 3233
Location: Utah
Javascript is pretty straightforward as well.

Code:

top.frames['myframe'].location.href = 'index.htm';


What I would do is something like this

Code:

<head>

<script type="text/javascript">
function open_in_frame(FrameName, FrameURL)
{
top.frames[FrameName].location.href = FrameURL;
}
</script>

</head>



That way you can use it many times without having to change any code.
 
Back to top
gries818
PostPosted: Wed Aug 13, 2008 2:04 pm Reply with quote

Respected Member
of PROnetworks
 
 


Joined: 07 Jul 2004
Posts: 6562
Ok the solution to this one is so easy it actually makes me embarrassed lol. The key is to treat the iframe like any other object on the page and just use:

Code:
document.getElementById('frm_main').src = "test.asp";
 
Back to top
Back to top
Index >> Webmaster Domain & Code Room >> Javascript redirect into a frame

Page 1 of 1

Post new topic   Reply to topic


Tired of the Ads? Registered users have 80% less adverts.