天天看點

修改iframe中src的簡單方法

任務描述:

通過點選等操作,修改嵌套的html中iframe的src,并動态展現出來

在網上搜了很多,大部分那都是說通過js進行操作,當然也有很多回報是效果不好,本人找了幾個小時終于找到一種簡單的方法,如下:

<span style="font-size:18px;"> <body>
<input type="button" value="改變位址" onClick="parent.displayinhere.location.href='http://www.baidu.com/'">
<iframe name="displayinhere" width=250px; height=200px; src="http://www.hao123.com">
</body> </span>
           

通過最簡單的方法,實作基本功能,這才是我想要的!Mark一下!