Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load page dynamically in iframe

I just want to load an html page in iframe on clicking a link or button in the same page. I used javascript to load the page dynamically. But, I couldn't do that. Please anyone guide me to do that. My code is as follows:

document.getElementById("iframeelem").src="newhtml.jsp";
like image 714
Developer404 Avatar asked Feb 28 '11 13:02

Developer404


People also ask

Do iframes slow down page load?

Can iframes affect the loading speed of my website? Every iframe on a page will increase the memory used as well as other computing resources like your bandwidth. So, you should not use iframe excessively without monitoring what's going on, or you might end up harming your page performance.

How do I do an iframe in href?

You can embed an iframe in a page that is inside another iframe on another web page. When you set the target attribute to _parent, the link will open in the web page that is holding the iframe. In most situations with iframes, this target will open links in the same way that the _parent target does.

How can I change src attribute in iframe?

To change the iframe src attribute, we will be using a select drop down menu, and a button element to activate the function that will change the src attribute. Note that this is only for example purposes, instead of using onClick you may want to consider using event handlers in an external script.

How do I change my iframe URL?

The idea behind changing the iframe source is to switch the web page in the display of iframe . In JavaScript we can change the source or redefine it with the JavaScript default method getElementById() . We can re-assign new path or URL of webpage to getElementById("idOfElement"). src .


1 Answers

Put this on the embedded page

<p>
<input type='button' name='Next' value='Next Page'
onclick='window.location.replace("http://timecrystal.co.uk/");' />
</p>
like image 151
Wyken Seagrave Avatar answered Sep 17 '22 15:09

Wyken Seagrave