Javascript ÔÚ HTML Ò³Ãæ¹â±ê´¦ÊäÈë×Ö·û
insertAtCurson º¯Êý´úÁ½²ÎÊý·Ö±ðΪ¶ÔÏóºÍÊäÈëµÄ×Ö·û
function insertAtCursor(myField, myValue)
{
if (document.selection)
{
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
else if (myField.selectionStart || myField.selectionStart == "0")
{
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
}
else
{
myField.value += myValue;
}
}
Ïà¹ØÎĵµ£º
ÔÖ·£ºhttp://www.dreamdu.com/blog/2008/10/19/json_in_javascript/
JavaScriptÖеÄJSON
×÷ÕߣºDouglas Crockford
ÔÎÄÍøÖ·£ºhttp://www.json.org/js.html
ÒëÕߣº¿É°®µÄºï×Ó
JavaScriptÕâÖÖ±à³ÌÓïÑÔÊ×ÒªµÄÄ¿µÄÊÇΪNetscape NavigatorÌṩһÖÖÒ³Ãæ½Å±¾ÓïÑÔ¡£ËüÈÔ±»ÆÕ±éµÄÈÏΪÊÇJavaµÄÒ»¸ö×Ó¼¯£¬µ«ÊÂʵ²¢·ÇÈç´Ë¡£ËüÊ ......
¶ÔÓÚÐí¶àÏëѧϰ JavaScript µÄÅóÓÑÀ´Ëµ£¬ÎÞÒÉÈçºÎÑ¡ÔñÈëÃŵÄÊé¼®ÊÇËûÃÇ×îÍ·ÌÛµÄÎÊÌ⣬»òÐíÒ²ÊÇËûÃÇһֱη¾å£¬ÉõÖÁ·ÅÆúѧϰ JavaScript µÄÀíÓÉ¡£
ÔÚ JavaScript ·½Ã棬×Ô¼º²»ÊÇʲôר¼Ò£¬Ò²²»ÊÇʲô¸ßÊÖ£¬µ«×Ô¼ºÒ»Â·×ßÀ´£¬JavaScript ´ÓÃÔãµ½ÈëµÀ£¬¶ÔÓÚ JavaScript Êé¼®µÄÈÏʶ»òÐí»¹ÓÐЩ½è¼ø¼ÛÖµ¡£
ÈëÃÅÍƼöÊ×Ñ¡Êé¼®£º¡ ......
JavaScriptÖеÄ5ÖÖʼþʹÓ÷½Ê½½â˵(ת)
Ϊ×é¼þÌṩʼþ´¦ÀíÈë¿Ú£¬¿ÉÒÔ¼«´óµÄÌá¸ß×é¼þµÄ·â±ÕÐÔ£¬Í¬Ê±ÓÖÄÜÈÃ×é¼þºÜºÃµÄºÍÍâ½çͨÐÅ¡£²¢ÇÒÕâÒ²ÊÇÎÒÃÇÒѾϰ¹ßʹÓõÄÒ»ÖÖ¿ª·¢Ä£Ê½£¬.NET¡¢DHTMLµÈ¶¼ÌṩÁËÒ»Ì×ÍêÕûµÄʼþ´¦ÀíÄ£ÐÍ¡£ÏÂÃæÊǹØÓÚʹÓÃDHTMLÖÐʼþµÄÒ»¸ö×ܽᡣ
DHTMLÌṩÁË3ÖÖʼþµÄÊ¹Ó ......
ÔÚJavascriptÖÐ×÷ÓÃÓòÊÇÓɺ¯Êý»®·ÖµÄ¡£
//ÉèÖÃÈ«¾Ö±äÁ¿foo
var foo = "test";
if(true){
var foo = "new foo";
}
//´ËʱfooΪ"new test"
alert(foo == "new foo");
function test(){
var foo = "old test";
}
//µ÷ÓÃʱ£¬fooÖ»ÔÚº¯Êý×÷ÓÃÓòÄÚÆð×÷ÓÃ
test();
//foo»¹ÊǵÈÓÚ"new test"
alert(foo == "new te ......
ºÜ¶àÈ˶¼ÏòÔÚ·þÎñÆ÷¶Ëµ÷Óÿͻ§¶ËµÄº¯ÊýÀ´²Ù×÷£¬Ò²¾ÍÊÇÔÚaspÖе÷ÓÃjavascript½Å±¾ÖÐÒѾ¶¨ÒåºÃµÄ½Å±¾º¯Êý¡£¾¹ýÑо¿£¬·¢ÏÖÁËһЩÃãÇ¿µÄ·½·¨¡£
1. ÓÃResponse.Write·½·¨Ð´Èë½Å±¾
±ÈÈçÔÚÄãµ¥»÷°´Å¥ºó£¬ÏȲÙ×÷Êý¾Ý¿â£¬ÍêÁ˺óÏÔʾÒѾÍê³É£¬¿ÉÒÔÔÚ×îºóÏëµ÷Óõĵط½Ð´ÉÏ
Response.Write("<script type='text/javascrip ......