Solved

Javascript refresh IFrame

Posted on 2004-09-06
4
757 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

763 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