JavaScriptÖÐconfirmµÄÓ÷¨
confirmº¯Êý
confirmº¯ÊýÓÃÓÚÌṩȷÈϹ¦ÄÜ£¬ËüÊ×ÏÈÏÔʾ¸ø¶¨µÄmessage²ÎÊýËù°üº¬µÄÐÅÏ¢£¬²¢ÌṩÁ½¸ö¿ÉÑ¡ÔñµÄ»Ø´ð“ok”ºÍ“cancel”£¬È»ºóµÈ´ýÓû§Ñ¡ÔñÆäÖеÄÒ»¸ö¡£Èç¹ûÓû§Ñ¡Ôñ“ok”Ôò·µ»Øtrue£»·ñÔò£¬ÈçÈôÑ¡Ôñ“cancel”Ôò·µ»Øfalse¡£¸Ãº¯ÊýµÄÓï·¨¸ñʽÈçÏ£º
window.confirm (message, ok, cancel)
ËüÓÐ3¸ö²ÎÊý£¬ÆäÖвÎÊýmessageÊÇÓûÏÔʾµÄ×Ö·û´®ÐÎʽµÄÌáʾÐÅÏ¢£»²ÎÊýokÒ²ÊÇÓÃÓÚÏÔʾµÄÒ»¸ö×Ö·û´®ÐÅÏ¢£¬Ëü¿ÉÒÔÊÇ“OK”£¬Ò²¿ÉÒÔÊÇÆäËû±íʾOKÒâÒåµÄÎı¾ÐÅÏ¢£¬Èç“I Agree”¡¢“I Like”µÈµÈ£»Í¬Ñù£¬²ÎÊýcancelÒ²ÊÇÓÃÓÚÏÔʾµÄ×Ö·û´®ÐÅÏ¢£¬¿ÉÒÔÊÇ“Cancel”Îı¾£¬Ò²¿ÉÒÔÊÇÆäËû±íʾCancelÒâÒåµÄÎı¾ÐÅÏ¢¡£
<script>
var bln = window.confirm("È·¶¨Âð?");
alert(bln)
</script>
»ò
Button.Attributes.Add("onclick", "javascript:if(!confirm('ÄãÈ·¶¨ÒªÉ¾³ý¸Ãϵͳ×ÉѯÂð£¿')) { return false; }")
Button.Attributes.Add("onclick","javascript:return confirm('ÇëÔڵǽºóÔËÐУ¬ÊÇ·ñÏÖÔÚÖØеǽ£¿')")
ÀýÈ磺<a onclick="javascript:if(!confirm('È·¶¨ÒªÉ¾³ýÑ¡ÔñµÄÐÅÏ¢Âð£¿\n´Ë²Ù×÷²»¿ÉÒÔ»Ö¸´£¡')) { return false; }" href="delhtml.asp?adid=<%=rs("adid")%>&type_oneid=<%=rs("type_oneid")%>"><font color="green">ɾ³ý</font></a>
Àý×Ó£º
ÒÔÏ·ÅÔÚ<head></head>ÖÐ
<script>
function rusure()
{
question = confirm("ȷʵҪȥ½øÈëÂð?")
if (question !="0")
{
window.open("","²âÊÔ¹«¸æ´°¿Ú","width=340,height=163,toolbar=0,status=0,menubar=0,resize=0");
}
}
</script>
ÒÔÏ·ÅÔÚ<body></body>ÖÐ
<a href="" onClick="rusure() ;return false;">À´µã»÷ÎÒ</a>
ÓÃconfirmÈ·ÈÏÌá½»¶¯×÷£¬ÌύȷÈÏÌáʾ
ÀýÈçÔÚÁôÑÔ²¾µã»÷ÖØдʱ£¬ÓÐʱºòÎÒÃÇÏ£Íû»áÓÐÒ»¸öÌáʾ£¬ÒÔÃâʧÎó²Ù×÷¡£´úÂëÈçÏ£º
¡¡¡¡
·½·¨Ò»
<input name="Submit" type="submit" onClick="if(confirm('ÊÇ·ñ´ò¿ªÍøÒ³£¿')) location='http://www.05376.com'" value="´ò¿ª">
¡¡¡¡·½·¨¶þ
<input name="Reset" type="reset" onClick="return clearbutton()" value="ÖØд">
<script type="text/javascript">
Ïà¹ØÎĵµ£º
Javascript´úÂë
<script>
var idTmr = "";
function copy(tabid){
var oControlRange = document.body.createControlRange();
oControlRange.add(tabid,0);
oControlR ......
±¾ÎÄת×Ô£ºhttp://www.felixwoo.com/archives/247
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæʵÃæÄ¿¡£
Ò»¡¢Ê²Ã´ÊDZհü£¿
“¹Ù·½”µÄ½âÊÍÊÇ£º±Õ°üÊ ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut= ......
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
<!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 ......
½øÈëеÄÏîÄ¿×éºó£¬·¢ÏÖ×Ô¼ºµÄ¹¦Á¦²îÔ¶ÁË£¬ËûÃÇдµÄjavaScript´úÂëÎҺܶ඼¿´²»¶®£¬ÏÖÔÚÎÒ×öjavaÇ°¶Ë¿ª·¢£¬javaScriptÊǷdz£ÖØÒªµÄ£¬ÏÖÔÚÎÒ¾ö¶¨ÖØÐÂÊ°Æð¡¶JavaScript¸ß¼¶³ÌÐòÉè¼Æ¡·Ñ§Ï°£¬³ÉΪһ¸öjavaScriptÄÜÊÖ¡£
¿´ÍêµÚÒ»ÕÂÎÒµ½»¹ÊǸ㲻Ã÷°×DOMµÄÒâ˼¡£
......