Solved

Javascript refresh IFrame

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now