Solved

Javascript refresh IFrame

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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

732 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