打开另一个html的链接 [英] Opening a link to another html

查看:101
本文介绍了打开另一个html的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要在使用javascript单击按钮时在同一个HTML页面中打开另一个Html页面



向我解释一个例子?



谢谢

解决方案

你必须用户iframe ... :)





 <   html  >  
< 正文 >
这是第一页或根页

< iframe src = http://facebook.com >
< p > 您的浏览器不支持iframe。< / p >
< < span class =code-leadattribute> / iframe >

< ; / body >
< / html >


试试这个JavaScript代码:

 document.getElementById(  changeThisIdIntoTheIdOfYourButton)。onclick = function(){
window.location.href = yourNewPage.html;
};


< a href =somelinktarget =_ parent>点击此处< / a> ; 



http://www.w3schools.com/jsref/ prop_anchor_target.asp [ ^ ]


Hi,

I need to open another Html page in the same HTML page when a button is clicked using javascript

Explain with me an example?

Thank You

解决方案

You have to user iframe for that...:)


<html>
<body>
This is first or root page

<iframe src="http://facebook.com">
  <p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>


Try this JavaScript code:

document.getElementById("changeThisIdIntoTheIdOfYourButton").onclick = function() {
    window.location.href = "yourNewPage.html";
};


<a href="somelink" target="_parent">click here</a>


http://www.w3schools.com/jsref/prop_anchor_target.asp[^]


这篇关于打开另一个html的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆