How to load page dynamically in iframe

2020-02-05 06:55发布

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";

3条回答
一夜七次
3楼-- · 2020-02-05 07:32

Your code is correct. Here is a tutorial, just in case: http://www.dyn-web.com/tutorials/iframes/

What is the error?

Verify the id of your frame and url are correct (type in the url in a browser window and make sure you get your page).

查看更多
神经病院院长
4楼-- · 2020-02-05 07:33

Put this on the embedded page

<p>
<input type='button' name='Next' value='Next Page'
onclick='window.location.replace("http://timecrystal.co.uk/");' />
</p>
查看更多
登录 后发表回答