javascriptµØÖ·À¸Ð´·¨
javascriptµØÖ·À¸Ð´·¨
±¾µØ¿Í»§¶ËÈ«Ñ¡checkbox.¿ÉÒÔÓÃÕâ¸öÑ¡¡£
0. Ç°ÑÔ
ËùνIEµØÖ·À¸±í´ïʽ£¬¾ÍÊÇÔÚIEµÄµØÖ·À¸ÖÐÊäÈë javascript:<´úÂë>£¬Ö´ÐÐijЩ¹¦ÄÜ£¬À´¶¯Ì¬¸Ä±äÔÓÐÒ³ÃæµÄ²ÎÊýÒԴﵽijЩĿµÄ£¬ÀýÈ翪·Å±»½ûÖ¹µÄ°´Å¥¡¢ÏÔʾԱ¾Òþ²ØµÄͼƬµÈµÈ¡£±¾ÎĽ«¾ÍIEµØÖ·À¸µÄʹÓ÷½·¨×öÒ»¸öÏêϸµÄ˵Ã÷¡£
1. ±í´ïʽµÄÊéд·½·¨
ÔÚIEµÄµØÖ·À¸ÖÐÊäÈë javascript:<´úÂë>£¬¼´¿ÉÔÚµ±Ç°Ò³ÃæÉÏÖ±½ÓÖ´ÐÐÖ¸¶¨µÄ´úÂë²¢Á¢¼´¿´µ½Ð§¹û¡£¶øÇÒ£¬<´úÂë>ÖпÉÒÔ°üº¬¶àÌõÓï¾ä£¬ÉõÖÁ¿ÉÒÔ°üº¬ if/for µÈÁ÷³Ì¿ØÖÆÓï¾ä¡£
´úÂëÒ»°ãÓÐÁ½ÖÖд·¨£º
javascript:<±í´ïʽ>
¸Ãд·¨½«»áÖ´Ðбí´ïʽ£¬²¢½«±í´ïʽµÄ½á¹ûÔÚµ±Ç°Ò³ÃæÄÚÏÔʾ¡£
javascript:<º¯Êý>
¸Ã±í´ïʽ½«»áÖ´ÐÐÖ¸¶¨µÄº¯Êý£¬¶øµ±Ç°Ò³ÃæµÄÏÔʾ²»»áÊܵ½Ó°Ïì¡£
ÄÇôIEÈçºÎÇø·ÖµØÖ·À¸ÖÐÊäÈëµÄ´úÂëµ½µ×ÊǺ¯Êý»¹ÊDZí´ïʽ£¿ÆäʵºÜ¼òµ¥£¬´úÂëµÄ×îºóÒ»ÌõÓï¾äÒÔ²ÎÊýÁбí () ½áÊø£¬Ôò×÷Ϊº¯Êý´¦Àí£¬²»¸üÐÂÒ³ÃæÏÔʾ£»´úÂëµÄ×îºóÒ»ÌõÓï¾ä²»ÒÔ () ½áÊø£¬Ôò×÷Ϊ±í´ïʽ´¦Àí£¬ÔÚµ±Ç°Ò³ÃæÄÚÏÔʾ±í´ïʽµÄ¼ÆËã½á¹û¡£
ÀýÈ磬ÔÚIEµÄµØÖ·À¸ÖÐÊäÈ룺
javascript:1+2
¸Ã±í´ïʽµÄĩβ²¢·Ç²ÎÊýÁÐ±í£¬Òò´ËIE½«1+2¿´×÷±í´ïʽ£¬Ö´Ðнá¹û½«ÏÔʾÔÚµ±Ç°´°¿ÚÄÚ£º
3
¶øÏÂÃæÕâ¶Î´úÂ룺
javascript:alert("Hello, world!")
´úÂëĩβΪ²ÎÊýÁÐ±í£¬Òò´ËIE½«Æä¿´×÷º¯Êý£¬Ö´ÐÐÖ®ºó½«³öÏÖµ¯³ö´°¿Ú£¬µ«ÊÇÍøÒ³µÄÄÚÈݲ»»áÓÐÈκα仯¡£ÔÙÈ磬
javascript:alert
¸Ã´úÂëÖ´Ðк󣬵±Ç°´°¿ÚÄÚÏÔʾ£º
[object]
ÕâÊÇÒòΪ´úÂëĩβ²»ÊDzÎÊýÁÐ±í£¬Òò´ËIE½«Æä×÷Ϊ±í´ïʽÀ´´¦Àí¡£alert Ϊ window ¶ÔÏóµÄÒ»¸ö·½·¨£¬Ò²Ëã×÷“[object]”£¬ËùÒÔ³öÏÖÁËÉÏÃæµÄ½á¹û¡£
ÔÙ¿´ÏÂÃæµÄÀý×Ó£º
javascript:a=1;b=2;c=3;alert(a+b*c)
ËäÈ»¸Ã¶Î´úÂëÖаüº¬Á˸³Öµ±í´ïʽºÍalert()º¯Êý£¬µ«ÓÉÓÚ´úÂë×îĩβÊDzÎÊýÁÐ±í£¬Òò´ËÒ³ÃæÄÚÈݲ»»á¸üС£
2. ½«±í´ïʽת»¯Îªº¯Êý
ͨ³£ÎÒÃÇÏ£ÍûʹÓà javascript:<º¯Êý> ÕâÖÖ¸ñʽ£¬ÒòΪ javascript:<±í´ïʽ> »á¸Ä±äÒ³ÃæÄÚÈݶøʹµÃÐÞ¸ÄʧȥÒâÒå¡£µ«ÓÐʱÎÒÃDz»µÃ²»Ê¹Óø³Öµ±í´ïʽÀ´´ïµ½Ä¿µÄ£¬Õâ¾ÍÐèÒª½«±í´ïʽת»»Îªº¯ÊýÀ´Ö´ÐС£Õâ¾ÍÐèÒªÀûÓÃÒ»¸öÌØÊâµÄº¯Êý£ºvoid()¡£¸Ãº¯Êý´øÓÐÒ»¸ö²ÎÊý¡£
±È½Ï³£ÓõÄת»¯·½Ê½ÓÐÁ½ÖÖ¡£Ò»ÖÖÊǽ«±í´ïʽ×÷Ϊvoid()º¯ÊýµÄ²ÎÊý£¬ÀýÈ磺
javascript:void(a=1)
Ö´ÐÐÖ®ºóÒ³ÃæÄÚÈÝûÓÐÈκα仯£¬µ«ÊÇÒ³ÃæÄÚÃûΪaµÄ±äÁ¿ÒѾ¸³ÖµÎª1ÁË¡£ÁíÒ»ÖÖ·½·¨ÊÇÔÚÕû¸ö´úÂëµÄ×îºóÖ´ÐÐvoid()º¯Ê
Ïà¹ØÎĵµ£º
µÚ¶þÕ Data Access Êý¾Ý·ÃÎÊ
One of the classic computer science problems is determining where data should be stored for optimal reading and writing. Where data is stored is related to how quickly it can be retrieved during code execution. This problem in JavaScri ......
ȺÀïÌÖÂÛ¹ýµÄÌâÄ¿£¬·ÖÏíһϡ£
function test(){
var m=n=1;
alert(m);
}
alert(n);
//ÒòΪtestº¯ÊýûÓÐÖ´ÐУ¬³Ì¶È¿ØÖÆÁ÷²»ÄܽøÈë½øÐнâÎö£¬ÀïÃæµÄ¶«Î÷¶ÔÍâÃæ²»¿É¼û£¬Òò´Ë±¨´í
function test(){
var m=n=1;
alert(m);
}
test();
alert(n);
//µ±testÖ´Ðкó£¬Í ......
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
&nb ......
ÇëÏÈ¿´ÏÂÌ⣺
if(true)
{
a = 1;
}
alert(a); //Êä³öɶ£¿
if(true)
{
var a = 1;
}
alert(a); //ÕâÓÖÊä³öʲô£¿
ÔÚfirefox3.5Ï£¬µÚÒ»¸öÊä³ö1;µÚ¶þ¸öÊä³öundefined£¡£¡£¡
ΪɶÄØ£¿ºÇºÇ£¬±¾ÈËÔÚ´Ë°àÃÅŪ¸«Ò»Ï£º
Ò»°ãÇé¿öÏÂȱʡvarÉùÃ÷ʱ£¬Ä¬È ......
Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required dat ......