html中,如何让页面在同一个页面打开

html中,如何让页面在同一个页面打开,第1张

通过嵌套iframe 实现在同一页面打开其他页面

<script type="text/javascript">

$(function () {

document.getElementById("ifm").src =""//Url地址

$("#ifm").load(function () {

var h = document.body.clientHeight

var w = document.body.clientWidth

document.getElementById("ifm").height = h + "px"

document.getElementById("ifm").width = w + "px"

})

})

</script>

<body style="overflow-y:hiddenoverflow-x:hidden">

<div id="pageone" style="">

<iframe name="ifm" id="ifm" scrolling="yes" style="background-color: transparent" marginwidth="0" marginheight="0" frameborder="0">

</iframe>

</div>

</body>

采用一个页面内嵌一个 iframe

然后把iframe 设置为 height 0 width 0

<!doctype html>

<html>

 <head>

  <meta charset="UTF-8">

  <meta name="Generator" content="EditPlus®">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

  <title>Document</title>

 </head>

 <body>

  

  页面

  <iframe src ="http://www.maomao365.com" height ="0" width="0" />

 </body>

</html>

看一下这个写法是不是你想要的哦 

如有疑问,请及时沟通。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7364225.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存