導航:首頁 > 萬維百科 > 網頁消息彈框設計

網頁消息彈框設計

發布時間:2020-09-27 04:50:05

1、設計網頁點擊添加按鈕如何彈出對話框

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 20px; width: 40px; background-color: #eeeeee; cursor: hand}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 60px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>添加公告</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 18px}
body {
background-color: #2286c2;
}
-->
</style>
</head>

<body>
<p class="STYLE1">公告標題:</p>
<form id="form1" name="form1" method="post" action="">
<label>
<input name="textfield" type="text" size="50" />
</label>
</form>
<p class="STYLE1">公告內容:</p>
<form id="form2" name="form2" method="post" action="">
<label>
<textarea name="textarea" cols="50" rows="20"></textarea>
</label>
<p>
<p><iframe frameborder="1" width="300" height="50" scrolling="no" src="upload.asp"></iframe></p>
</p>
</form>
<form id="form3" name="form3" method="post" action="">

<label> 
<input type="submit" name="Submit" value="提交" /> 
 
</label>
<input type="submit" name="Submit2" value="重置" />
</form>

<p> </p>
</body>
</html>

2、怎樣讓網頁彈出消息框??

開始--運行--復制下面的命令 粘貼進去 回車 即可
reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Main" /v "DisableFirstRunCustomize" /d 1 /t REG_DWORD /f

3、網頁點擊按鈕彈出信息框?

彈出信息框.並且打開一個網頁地址. 按鈕部分:屬性里加上onclick="fun()" head區域添加代碼: function fun(){ window.open("要彈出的網址","_blank","width=200,height=300") } </script> 參數可自行修改

4、如何在網頁設計按一下就彈出對話框

<script>
function DelMsg()
{
var daymsg = document.getElementById("radDay");
if(daymsg.checked == true)
{
if(window.confirm("確認投票嗎?"))
{
return true;
}else
{
return false;
}

}
}
</script>
投票按鈕
<button ... onclick="return DelMsg();" >投票</Button>

5、設計一個網頁,頁面中有一幅圖片,單擊圖片彈出一個消息框

用js onclick="alert('消息框')";

6、網頁中怎麼添加彈出信息窗口

【1、最基本的彈出窗口代碼】
其實代碼非常簡單:
<SCRIPT LANGUAGE="javascript">
<!--
window.open ('page.html')
-->
</SCRIPT>
因為這是一段javascripts代碼,所以它們應該放在<SCRIPT LANGUAGE="javascript">之間。<!-- 和 -->是對一些版本低的瀏覽器起作用,在這些老瀏覽器中不會將標簽中的代碼作為文本顯示出來。要養成這個好習慣啊。
window.open ('page.html') 用於控制彈出新的窗口page.html,如果page.html不與主窗口在同一路徑下,前面應寫明路徑,絕對路徑(http://)和相對路徑(../)均可。
用單引號和雙引號都可以,只是不要混用。
這一段代碼可以加入HTML的任意位置,<head>和</head>之間可以,<body>間</body>也可以,越前越早執行,尤其是頁面代碼長,又想使頁面早點彈出就盡量往前放。也可以,越前越早執行,尤其是頁面代碼長,又想使頁面早點彈出就盡量往前放。
【2、經過設置後的彈出窗口】
下面再說一說彈出窗口的設置。只要再往上面的代碼中加一點東西就可以了。我們來定製這個彈出的窗口的外觀,尺寸大小,彈出的位置以適應該頁面的具體情況。
<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')
//寫成一行
-->
</SCRIPT>
參數解釋:
<SCRIPT LANGUAGE="javascript"> js腳本開始;
window.open 彈出新窗口的命令;
'page.html' 彈出窗口的文件名;
'newwindow' 彈出窗口的名字(不是文件名),非必須,可用空''代替;
height=100 窗口高度;
width=400 窗口寬度;
top=0 窗口距離屏幕上方的象素值;
left=0 窗口距離屏幕左側的象素值;
toolbar=no 是否顯示工具欄,yes為顯示;
menubar,scrollbars 表示菜單欄和滾動欄。
resizable=no 是否允許改變窗口大小,yes為允許;
location=no 是否顯示地址欄,yes為允許;
status=no 是否顯示狀態欄內的信息(通常是文件已經打開),yes為允許;
</SCRIPT> js腳本結束
【3、用函數控制彈出窗口】
下面是一個完整的代碼:
<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>
  這里定義了一個函數openwin(),函數內容就是打開一個窗口。在調用它之前沒有任何用途。
怎麼調用呢?
  方法一:<body onload="openwin()"> 瀏覽器讀頁面時彈出窗口;
  方法二:<body onunload="openwin()"> 瀏覽器離開頁面時彈出窗口;
  方法三:用一個連接調用:<a href="#" onclick="openwin()">打開一個窗口</a>
注意:使用的「#」是虛連接。
  方法四:用一個按鈕調用:<input type="button" onclick="openwin()" value="打開窗口">
【4、同時彈出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")
//寫成一行
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>
  為避免彈出的2個窗口覆蓋,用top和left控制一下彈出的位置不要相互覆蓋即可。最後用上面說過的四種方法調用即可。
注意:2個窗口的name(newwindows和newwindow2)不要相同,或者乾脆全部為空。OK?
【5、主窗口打開文件1.htm,同時彈出小窗口page.html】
如下代碼加入主窗口<head>區:
<script language="javascript">
<!--
function openwin() {
window.open(http://wwww.oufens.com,"","width=200,height=200")
}
//-->
</script>
加入<body>區:
<a href="1.htm" onclick="openwin()">open</a>即可。
【6、彈出的窗口之定時關閉控制】
下面我們再對彈出的窗口進行一些控制,效果就更好了。如果我們再將一小段代碼加入彈出的頁面(注意是加入到page.html的HTML中,可不是主頁面中,否則...),讓它10秒後自動關閉是不是更酷了?
首先,將如下代碼加入page.html文件的<head>區:
<script language="javascript">
function closeit() {
setTimeout("self.close()",10000) //毫秒
}
</script>
然後,再用<body onload="closeit()"> 這一句話代替page.html中原有的<BODY>這一句就可以了。(這一句話千萬不要忘記寫啊!這一句的作用是調用關閉窗口的代碼,10秒鍾後就自行關閉該窗口。)

7、網頁中怎麼添加彈出信息窗口

彈出信息。選中整個頁面,就是點中<body>。這樣能讓網頁瀏覽著一打開就能看到信息,當然,也可以使用點擊圖片或文本來彈出信息,不過這樣要使用相應的事件。
點擊窗口\行為,打開行為窗口。
點擊+號\彈出信息,打開彈出信息對話框。在對話框中輸入想告訴瀏覽著的信息。
4
調整事件,選擇事件onload,也就是一打開的意思,這樣一個一打開網頁就彈出信息的彈出就設計好了。
5
點擊F12預覽。

8、網頁設計用javascript實現彈出對話框的一個示例

看你想怎麼樣了,只是彈出一個對話框提示消息的話,就用alert(msg),msg 是提示信息 ;
confirm 也是彈出一個對話框,但是它彈出的一個包含"確定"與"取消"的對話方塊. 如果用戶按下了確定,返回true;或者按下了取消,返回false
示例如
<body>
<script type="text/javascript">
alert("這是彈出框")
confirm("你今天開心嗎")
</script>
</body>
</html>

9、網頁設計,如果想實現當單擊網頁上某對象時,彈出一個消息對話框,如何指定?

您好,您可以嘗試如下代碼,不知效果是否如您所願:

<html>
<head>
<title>demo</title>
<meta charset="utf-8" />
</head>
<body>
<div id="box"></div>
<script type="text/javascript">
var box = document.getElementById("box");
box.onclick = function()
{
   alert("要彈出的消息...");
}
</script>
</body>
</html>

10、網頁中如圖的彈出式提示框怎麼實現的,最好有代碼。

<HTML><HEAD>
<TITLE>網頁特效--頁面右下角彈出類似QQ或MSN的消息提示-www.qpsh.com</TITLE>
<SCRIPT language=JavaScript>
<!--

/**//*
** ==================================================================================================
** 類名:CLASS_MSN_MESSAGE
** 功能:提供類似MSN消息框
** 示例:www.qpsh.com
---------------------------------------------------------------------------------------------------

var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有1封消息","今天請我吃飯哈");
MSG.show();

---------------------------------------------------------------------------------------------------
** 作者:網頁特效
** 網站:www.qpsh.com
** 日期:2007-8-30
** ==================================================================================================
**/

/**//*
* 消息構造
*/
function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){
this.id = id;
this.title = title;
this.caption= caption;
this.message= message;
this.target = target;
this.action = action;
this.width = width?width:200;
this.height = height?height:120;
this.timeout= 150;
this.speed = 20;
this.step = 1;
this.right = screen.width -1;
this.bottom = screen.height;
this.left = this.right - this.width;
this.top = this.bottom - this.height;
this.timer = 0;
this.pause = false;
this.close = false;
this.autoHide = true;
}

/**//*
* 隱藏消息方法
*/
CLASS_MSN_MESSAGE.prototype.hide = function(){
if(this.onunload()){

var offset = this.height>this.bottom-this.top?this.height:this.bottom-this.top;
var me = this;

if(this.timer>0){
window.clearInterval(me.timer);
}

var fun = function(){
if(me.pause==false||me.close){
var x = me.left;
var y = 0;
var width = me.width;
var height = 0;
if(me.offset>0){
height = me.offset;
}

y = me.bottom - height;

if(y>=me.bottom){
window.clearInterval(me.timer);
me.Pop.hide();
} else {
me.offset = me.offset - me.step;
}
me.Pop.show(x,y,width,height);
}
}

this.timer = window.setInterval(fun,this.speed)
}
}

/**//*
* 消息卸載事件,可以重寫
*/
CLASS_MSN_MESSAGE.prototype.onunload = function() {
return true;
}
/**//*
* 消息命令事件,要實現自己的連接,請重寫它
*
*/
CLASS_MSN_MESSAGE.prototype.oncommand = function(){
//this.close = true;
this.hide();
window.open("http://www.qpsh.com");

}
/**//*
* 消息顯示方法
*/
CLASS_MSN_MESSAGE.prototype.show = function(){

var oPopup = window.createPopup(); //IE5.5+

this.Pop = oPopup;

var w = this.width;
var h = this.height;

var str = "<DIV style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: " + w + "px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + h + "px; BACKGROUND-COLOR: #c9d3f3'>"
str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0>"
str += "<TR>"
str += "<TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD>"
str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'>" + this.caption + "</TD>"
str += "<TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19>"
str += "<SPAN title=關閉 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD>"
str += "</TR>"
str += "<TR>"
str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height=" + (h-28) + ">"
str += "<DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'>" + this.title + "<BR><BR>"
str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=false id='btCommand'><FONT color=#ff0000>" + this.message + "</FONT></A>fghfghfghghghgh<A href='http://www.qpsh.com' hidefocus=false id='ommand'><FONT color=#ff0000>dfgdfgfg</FONT></A></DIV>"
str += "</DIV>"
str += "</TD>"
str += "</TR>"
str += "</TABLE>"
str += "</DIV>"

oPopup.document.body.innerHTML = str;

this.offset = 0;
var me = this;

oPopup.document.body.onmouseover = function(){me.pause=true;}
oPopup.document.body.onmouseout = function(){me.pause=false;}

var fun = function(){
var x = me.left;
var y = 0;
var width = me.width;
var height = me.height;

if(me.offset>me.height){
height = me.height;
} else {
height = me.offset;
}

y = me.bottom - me.offset;
if(y<=me.top){
me.timeout--;
if(me.timeout==0){
window.clearInterval(me.timer);
if(me.autoHide){
me.hide();
}
}
} else {
me.offset = me.offset + me.step;
}
me.Pop.show(x,y,width,height);

}

this.timer = window.setInterval(fun,this.speed)

var btClose = oPopup.document.getElementById("btSysClose");

btClose.onclick = function(){
me.close = true;
me.hide();
}

var btCommand = oPopup.document.getElementById("btCommand");
btCommand.onclick = function(){
me.oncommand();
}
var ommand = oPopup.document.getElementById("ommand");
ommand.onclick = function(){
//this.close = true;
me.hide();
window.open(ommand.href);
}
}
/**//*
** 設置速度方法
**/
CLASS_MSN_MESSAGE.prototype.speed = function(s){
var t = 20;
try {
t = praseInt(s);
} catch(e){}
this.speed = t;
}
/**//*
** 設置步長方法
**/
CLASS_MSN_MESSAGE.prototype.step = function(s){
var t = 1;
try {
t = praseInt(s);
} catch(e){}
this.step = t;
}

CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){
try {
this.left = left !=null?left:this.right-this.width;
this.right = right !=null?right:this.left +this.width;
this.bottom = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height;
this.top = top !=null?top:this.bottom - this.height;
} catch(e){}
}
var MSG1 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有1封消息","今天請我吃飯哈");
MSG1.rect(null,null,null,screen.height-50);
MSG1.speed = 10;
MSG1.step = 5;
//alert(MSG1.top);
MSG1.show();

//同時兩個有閃爍,只能用層代替了,不過層不跨框架
//var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有2封消息","好的啊");
// MSG2.rect(100,null,null,screen.height);
// MSG2.show();
//-->
</SCRIPT>

<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>網頁特效</BODY></HTML>

與網頁消息彈框設計相關的知識