javascript ѧϰ±Ê¼Ç£¨6£©
1. window ¶ÔÏóÊÇÕû¸ö BOM µÄºËÐÄ,ËùÓжÔÏóºÍ¼¯ºÏ¶¼ÒÔijÖÖ·½Ê½»Ø½Óµ½ window ¶ÔÏó.
window ¶ÔÏó±íʾÕû¸öä¯ÀÀÆ÷´°¿Ú,µ«²»±íʾÆäÖаüº¬µÄÄÚÈÝ.
2. ¿ª·¢Õß¿ÉÒÔʹÓà window ¶ÔÏóÒƶ¯ºÍµ÷Õûä¯ÀÀÆ÷´°¿ÚµÄ±íÏÖÐÎʽ.
window.moveBy(dx,dy); //Ïà¶Ôµ±Ç°Î»ÖÃ,ˮƽÒƶ¯dx¸öÏñËØ,´¹Ö±Òƶ¯dy¸öÏñËØ
window.moveTo(x,y); //Òƶ¯µ½(x,y)λÖÃ
window.resizeBy(dw,dh); //Ïà¶Ôµ±Ç°´óС¸Ä±ä(dx,dy)
window.resizeTo(w,h); //´°¿Ú´óСµ÷ÕûΪ(x,y)
3. ¿ÉÒÔÓà window.open() ·½·¨´ò¿ªÐ´°¿Ú.ʹÓà window.close() ¹Ø±Õд°¿Ú.
window.open("http://www.xxx.com","anyFrame","height=550,width=12,top=23,left=222,resizable")
4. д°¿Ú»¹ÓжԴò¿ªËüµÄ´°¿ÚµÄÒýÓÃ,´æ·ÅÔÚopenerÊôÐÔÖÐ,Ö»ÔÚд°¿ÚµÄ×î¸ß²ã window ¶ÔÏó²ÅÓÐ opener ÊôÐÔ.
var test = window.open("http://www.xxx.com","anyFrame","height=550,width=12,top=23,left=222,resizable");
alert(test.opener == window); //outputs "true"
5. ¿ÉÒÔʹÓà window ¶ÔÏóµÄ3Öз½·¨µ¯³öÐÅÏ¢.alert(),confirm(),prompt().
alert():Ö»ÏÔʾOK°´Å¥
confirm():ÏÔʾOK°´Å¥ºÍcancel°´Å¥
prompt():ÏÔʾOK°´Å¥ºÍcancel°´Å¥,»¹ÓÐÎı¾¿ò.
6. ¿ÉÒÔͨ¹ý window.status ºÍ window.defaultStatus ÕâÁ½¸öÊôÐÔÖµÉèÖô°¿Ú״̬À¸ÐÅÏ¢.
status ÊôÐÔ¿ÉÒÔÁÙʱ¸Ä±ä״̬À¸ÐÅÏ¢
defaultStatus ÊôÐÔ¿ÉÒÔÔÚÓû§À뿪´°¿Úǰʹ״̬À¸Ò»Ö±ÏÔʾ¸ÃÎı¾
window.defaultStatus = "hello world!";
or
<a href="#" mce_href="#" onmouseover="window.status='hello world'">hello world</a>
7. ¿ÉÒÔʹÓà window ¶ÔÏóµÄ history ÊôÐÔ¼°Æä·½·¨·ÃÎÊä¯ÀÀÆ÷´°¿ÚµÄÀúÊ·.
//ºóÍËÒ»Ò³
window.history.go(-1);
//or
window.history.back();
//Ç°½øÒ»Ò³
window.history.go(1);
//or
window.history.forward();
//²é¿´ÀúÊ·Ò³ÃæÊý,ÕâÑù¿ÉÒÔÖªµÀ¿ÉÒÔÇ°½ø»òÕߺóÍ˶àÉÙÒ³
window.history.length
Ïà¹ØÎĵµ£º
ÀûÓÃjsÀ´¶¯Ì¬´´½¨±í¸ñÓÐÁ½ÖÖ¸ñʽ£¬appendChild()ºÍinsertRow¡¢insertCell()¡£Á½ÖÖ·½Ê½Æäʵ²î²»¶à£¬µ«µÚÒ»ÖÖÓпÉÄÜÔÚIEÉÏÓÐÎÊÌ⣬ËùÒÔÍƼö´ó¼ÒʹÓõڶþÖÖÁË£¬Ö±½Ó˵°É¡£
1¡¢inserRow()ºÍinsertCell()º¯Êý
insertRow()º¯Êý¿ÉÒÔ´ø²ÎÊý£¬ÐÎʽÈçÏ£º
insertRow(index)£ºindex´Ó0¿ªÊ¼
Õâ¸öº¯Êý½«ÐÂÐÐÌí¼Óµ½indexµÄÄÇһР......
ΪÁËÌá¸ßÍøÕ¾µÄ¼ÓÔØËٶȣ¬ÓÐÒ»¸öºÜÖØÒªµÄÊֶξÍÊÇÔÚÓû§ä¯ÀÀ¹ý³ÌÖеÄÉÏÓÎÍøÕ¾×öÒ»¸öÎļþµÄÔ¤¼ÓÔØ¡£Ô¤¼ÓÔØÎļþÒ»°ãÓÐÁ½ÖÖ³£Óõķ½Ê½£ºxhrºÍ¶¯Ì¬²åÈë½ÚµãµÄ·½Ê½¡£¶¯Ì¬²åÈë½ÚµãÊÇ×îΪ¼òµ¥Ò²×îΪ¹ã·ºµÄÒ»ÖÖÒì²½¼ÓÔØ·½Ê½(ÀýÈçyuiµÄGetÄ£¿é)£¬È»ºóʹÓö¯Ì¬²åÈë½Úµã·½·¨¼ÓÔصÄÎļþ¶¼»áÔÚ¼ÓÔغóÁ¢¼´Ö´ÐУ¬javascriptµÄÖ´ÐÐÒ»·½Ãæ»áÕ ......
Ò».ʹÓÃRegisterStartUpScript×¢²áÖ»Ö´ÐÐÒ»´ÎµÄjavascript
µÚ1²½(´´½¨²¢×¢²á²¢Ê¹ÓÃjavascript)£ºPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//´´½¨JavaScript
string info = "<mce:script type="text/javascript"><!--alert('ÄãºÃ£¬ÎÒÊÇXXX£¡')// --></mce:scrip ......
´ò¿ªÇëÇó
¡¡¡¡ÓÐÁËÒªÁ¬½ÓµÄ URL ºó¾Í¿ÉÒÔÅäÖÃÇëÇóÁË¡£¿ÉÒÔÓà XMLHttpRequest ¶ÔÏóµÄ open() ·½·¨À´Íê³É¡£¸Ã·½·¨ÓÐÎå¸ö²ÎÊý:
request-type:·¢ËÍÇëÇóµÄÀàÐÍ¡£µäÐ͵ÄÖµÊÇ GET »ò POST£¬µ«Ò²¿ÉÒÔ·¢ËÍ HEAD ÇëÇó¡£
url:ÒªÁ¬½ÓµÄ URL¡£
asynch:Èç¹ûÏ£ÍûʹÓÃÒì²½Á¬½ÓÔòΪ true£¬·ñÔòΪ false¡£¸Ã²ÎÊýÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏΪ true¡£
......
ÓÃJavascriptʵÏÖ¸ù¾ÝÏÂÀÁбícategoryµÄÑ¡Ôñ½á¹û£¬¸Ä±äÏÂÀÁбísub_categoryµÄÑ¡Ïî
<mce:script language="javascript" type="text/javascript">
<!--
function changeSubCategory() {
var sel_category = document.getElementById("category");
var sel_sub_category = document.getElementById("sub_c ......