當前位置:編程學習大全網 - 編程語言 - html怎麽做壹個按鈕,就彈出壹段文字的窗口呀

html怎麽做壹個按鈕,就彈出壹段文字的窗口呀

html做點壹個按鈕就彈出文字的代碼:

最基本的彈出窗口代碼

<SCRIPT LANGUAGE="javascript">

<!-- window.open ('page.html') --> </SCRIPT>

經過設置後的彈出窗口

<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=n o, status=no') //-->

</SCRIPT>

用函數控制彈出窗口

<html>

<head>

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

</head>

<body onload="openwin()">

</body>

</html>

同時彈出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=n o, status=no")//window.open ("page2.html", "newwindow2", "height=100, width=100, top=1 00, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, loca tion=no, status=no")//} //-->

</script>

主窗口打開文件1.htm,同時彈出小窗口page.html

如下代碼加入主窗口<head>區:

<script language="javascript">

<!-- function openwin() { window.open("page.html","","width=200,height=200") } //-->

</script>

加入<body>區: <a href="1.htm" onclick="openwin()">open</a>

彈出的窗口之定時關閉控制

首先,將如下代碼加入page.html文件的<head>區:

<script language="JavaScript">

function closeit()

{ setTimeout("self.close()",10000) //毫秒 }

</script>

在彈出窗口中加上壹個關閉按鈕

<FORM>

<INPUT TYPE='BUTTON' VALUE='關閉' onClick='window.close()'>

</FORM>

內包含的彈出窗口-壹個頁面兩個窗口

<html>

<head>

<SCRIPT LANGUAGE="JavaScript">

function openwin()

{ OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");

//OpenWindow.document.write("<TITLE>例子</TITLE>")

OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")

OpenWindow.document.write("<h1>Hello!</h1>")

OpenWindow.document.write("New window opened!")

OpenWindow.document.write("</BODY>")

OpenWindow.document.write("</HTML>")

OpenWindow.document.close() }

</SCRIPT>

</head>

<body>

<a href="#" onclick="openwin()">打開壹個窗口</a>

<input type="button" onclick="openwin()" value="打開窗口">

</body>

</html>

終極應用--彈出的窗口之Cookie控制

首先,將如下代碼加入主頁面HTML的<HEAD>區:

<script>

function openwin(){

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

function get_cookie(Name) { var search = Name + "=" var returnvalue = "";

if (document.cookie.length > 0) { offset = document.cookie.indexOf(search)

if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset);

if (end == -1)

end = document.cookie.length;

returnvalue=unescape(document.cookie.substring(offset, end)) } }

return returnvalue; }

function loadpopup(){ if (get_cookie('popped')==''){ openwin()

document.cookie="popped=yes" } }

</script>?

Asp教程-ASP應用

this.Response.Write(<Script>window.open('WebForm7.aspx','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40');</script>");

彈出跟妳當前的窗口有沒有菜單工具欄沒有關系,妳只要在頁面中寫壹個腳本它就彈出了.比如

<a href=# onclick="window.open('xxx.aspx','窗口名稱','參數');">xxxxx</a>

以下列出壹些彈出窗口的參數:

(如:"fullscreen=yes, toolbar=yes")。下面是被支持的各種特性。

channelmode = { yes | no | 1 | 0 } 是否在窗口中顯示階梯模式。默認為no。

directories = { yes | no | 1 | 0 } 是否在窗口中顯示各種按鈕。默認為yes。

fullscreen = { yes | no | 1 | 0 } 是否用全屏方式顯示瀏覽器。默認為no。

height = number 指定窗口的高度,單位是像素。最小值是100。

left = number 指定窗口距左邊框的距離,單位是像素。值必須大於或者等於0。

location = { yes | no | 1 | 0 } 指定是否在窗口中顯示地址欄。默認為yes。

menubar = { yes | no | 1 | 0 } 指定是否在窗口中顯示菜單欄。默認為yes。

resizable = { yes | no | 1 | 0 } 指定是否在窗口中顯示可供用戶調整大小的句柄。默認為yes。

scrollbars = { yes | no | 1 | 0 } 指定是否在窗口中顯示橫向或者縱向滾動條。默認為yes。

status = { yes | no | 1 | 0 } 指定是否在窗口中顯示狀態欄。默認為yes。

titlebar = { yes | no | 1 | 0 } 指定是否在窗口中顯示標題欄。在非調用HTML Application或者壹個對話框的情況下,這壹項將被忽略。默認為yes。

toolbar = { yes | no | 1 | 0 } 指定是否在窗口中顯示工具欄,包括如前進、後退、停止等按鈕。默認為yes。

top = number 指定窗口頂部的位置,單位是像素。值必須大於或者等於0。

width = number 指定窗口的寬度,單位是像素。最小值是100。

  • 上一篇:使用coreldraw時如何設置字體的高度和寬度?
  • 下一篇:個人試用期轉正工作總結開頭
  • copyright 2024編程學習大全網