d出窗口的html的代码是怎么写的?

d出窗口的html的代码是怎么写的?,第1张

1、最基本的d出窗口代码

<SCRIPT LANGUAGE="javascript">

<!--

window.open ("page.html")

-- >

</SCRIPT> 

window.open ("page.html") 用于控制d出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。

2、经过设置后的d出窗口

<SCRIPT LANGUAGE="javascript">

<!--

window.open ("page.html", "newwindow", "height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")&nbsp

->

</SCRIPT>

<SCRIPT LANGUAGE="javascript">js脚本开始;window.open d出新窗口的命令;"page.html" d出窗口的文件名;"newwindow" d出窗口的名字(不是文件名),非必须,可用空"代替;

3、用函数控制d出窗口

<script LANGUAGE="JavaScript">

<!--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

</script>

这里定义了一个函数openwin(),函数内容就是打开一个窗口。

4、同时d出2个窗口

<script LANGUAGE="JavaScript">

<!--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

&nbsp

window.open ("page2.html", "newwindow2", "height=100, width=100, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

</script>

为避免d出的2个窗口覆盖,用top和left控制一下d出的位置不要相互覆盖即可。

5、主窗口打开文件1.htm,同时d出小窗口page.html

<script language="javascript">

<!--

function openwin() {

window.open("page.html","","width=200,height=200")

}

-->

</script>

如果需要定时提醒,可以用定时器

例如:

setTimeout(function () {

//要做的事项

console.log(2)

}, 100)

或者你可以把要求写的清楚一些,比如:具体实现什么功能,要提醒什么


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

原文地址: http://outofmemory.cn/zaji/6277009.html

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

发表评论

登录后才能评论

评论列表(0条)

保存