Solved

Javascript refresh IFrame

Posted on 2004-09-06
4
725 Views
Last Modified: 2008-02-01
Hey everyone, this is kind of a combo php/javascript but the php part should be done.

Im loading a list of events from a database and making a link on each on so that when you click the link an IFrame refreshes and displays details about that event. The idea is the link has a <a href='javascript:refreshframe(id)'> where id is the id of the event.

Now  I can get the list there with the link to the function call, passing the id. That all works. What im having trouble doing is making it so that in the javascript code it will refresh the iframe with the id of the event passed in the url so it would be something like.

document.iframeid.location.href='mypage.php?id='+id

any idea how i can have this refresh?
0
Comment
Question by:areric
4 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 25 total points
ID: 11994148
<script>
function refreshframe(id) {
  document.getElementById("myframe").src = "http://somesite.com/mypage.php?id=" + id;
}
</script>

<a href="javascript:refreshframe(100)">refresh</a>
<iframe id="myframe" src="about:blank"></iframe>
0
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 25 total points
ID: 11995002
Hi

You could also use document.frames['myFrame'].location.href="http://newpage.html?id="+id;

Regards,
Zyloch
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now