?
Solved

Javascript refresh IFrame

Posted on 2004-09-06
4
Medium Priority
?
773 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 100 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 100 total points
ID: 11995002
Hi

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

Regards,
Zyloch
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…
Suggested Courses

765 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