javascript ×Ö·û´®´¦Àí
Ò»¡¢ÉùÃ÷×Ö·û´®:
var normal_monkey = "I am a monkey!<br>";
document.writeln("Normal monkey " + normal_monkey);
var bold_monkey = normal_monkey.bold();
document.writeln("Bold monkey " + bold_monkey);
ÕâÀïµÄÉùÃ÷£º var bold_monkey = normal_monkey.bold();
ºÍÏÂÃæ¶ÔÉùÃ÷ÊǵÈͬµÄ£º
var bold_monkey = "<b>" + normal_monkey + "</b>";
µÚ1¸ö°æ±¾µÄÉùÃ÷¿´ÆðÀ´Òª¼òÃ÷µÃ¶à¡£ÕâÀïÓõ½ÁË×Ö·û´®¶ÔÏóÖÐ
µÄbold¶ÔÏó£¬ÆäËûµÄ×Ö·û´®¶ÔÏó»¹ÓÐindexOf, charAt,
substring, ÒÔ¼°split, ÕâЩ·½·¨¿ÉÒÔÉîÈë×Ö·û´®µÄ×é³É½á¹¹¡£
Ê×ÏÈÎÒÃÇÑо¿Ò»ÏÂindexOf¡£
2¡¢indexOf
indexOfÓÃÓÚ·¢ÏÖһϵÁеÄ×Ö·ûÔÚÒ»¸ö×Ö·û´®ÖеÈλÖò¢¸æËßÄã×Ó×Ö·û´®µÄÆðʼλÖá£Èç
¹ûÒ»¸ö×Ö·û´®Öв¿°üº¬¸Ã×Ó×Ö·û´®ÔòindexOf·µ»Øreturns "-1."
Àý×Ó£º
var the_word = "monkey";
//ÈÃÎÒÃÇ´Óµ¥´Ê "monkey"¿ªÊ¼¡£
var location_of_m = the_word.indexOf("m");
//location_of_m(×ÖĸmµÄλÖÃ)½«Îª0£¬ÒòΪ×ÖĸmλÓÚ¸Ã×Ö·û´®µÄÆðʼλÖá£
var location_of_o = the_word.indexOf("o");
//location_of_o(×ÖĸoµÄλÖÃ)½«Îª1¡£
var location_of_key = the_word.indexOf("key");
//location_of_key(keyµÄλÖÃ)½«Îª3ÒòΪ×Ó×Ö·û´®“key”ÒÔ×Öĸk¿ªÊ¼£¬¶øk
ÔÚµ¥´ÊmonkeyÖеÄλÖÃÊÇ3¡£
var location_of_y = the_word.indexOf("y");
//location_of_y)×ÖĸyµÄλÖÃ)ÊÇ5¡£
var cheeky = the_word.indexOf("q");
//cheekyÖµÊÇ-1£¬ÒòΪÔÚµ¥´Ê“monkey”ÖÐûÓÐ×Öĸq¡£
indexOf¸üʵÓÃÖ®´¦:
var the_email = prompt("What’s your email address?", "");
var the_at_is_at = the_email.indexOf("@");
if (the_at_is_at&nbs
Ïà¹ØÎĵµ£º
FusionChart ¾Í²»ÓýéÉÜÁË°Ñ£¬Ò»¿îÖ§³Ö¶àÖÖÓïÑÔµÄͼ±íÉú³É¿Ø¼þ£¬Éú³ÉµÄͼ±í·á¸»£¬ÃÀ¹Û£¬ÇÒÓж¯Ì¬¸Ð£¬ÒòΪËüÉú´æµÄ¶«Î÷¾ÍÊÇÒ»¸öflash¡£Ò»Ï½éÉÜÒ»ÏÂËüµÄjavascript ʵÏÖ·½Ê½°Ñ¡£
·Ï»°ÉÙ˵£¬Ö±½ÓÉÏʵÀý
<HTML>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡ <HEAD>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡ <SCRIPT LANGUAGE="Javascri ......
µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃinsertRowÌí¼ÓÐУ¬Ê¹ÓÃinsertCellÌí¼Óµ¥Ôª¸ñ£¬ÔÙÓÃinnerHTMLÌî³äµ¥Ôª¸ñ¡£Ê¹ÓÃdeleteRowɾ³ýÐУ¬´úÂëÈçÏ£º
Javascript´úÂ룺
function addRow()
{
var root = document.getElementById("tbody")
var&nb ......
Èç¹û¶ÔjavascriptÁ˽ⲻÊÇÌرðÉîÈëµÄ»°,ºÜÈÝÒ׾ͻáд³ö²»¼æÈݵĴúÂë(¾ÍÏñÎÒ),Õâʱºò¾ÍµÃÅжÏä¯ÀÀÆ÷ÁË¡£±ÈÈçʼþÕìÌý¡¢Ò»Ð©Êó±êºÍ¼üÅÌʼþ¡¢RangeµÈ,һЩ¶¼»á²»Ò»Ñù.ÏÂÃæÁгö¼¸ÖÖ³£Óõļì²âä¯ÀÀÆ÷·½·¨£¬ÒÔ÷ϹÛÖÚ!
¶ÔÏó/ÌØÕ÷¼ì²â·¨
¸Ã·½·¨ÊÇÒ»ÖÖÅжÏä¯ÀÀÆ÷ÄÜÁ¦£¨¶ø·Çä¯ÀÀÆ÷µÄÈ·ÇÐÐͺţ©µÄͨÓ÷½·¨¡£´ó²¿·ÖJSר¼ÒÈÏΪÕâ¸ö·½· ......
Èç¹ûÄãÏë½øÒ»²½Á˽âÈçºÎÓÃJavaScriptÀ´ÎªÍøÒ³Ìí¼Ó½»»¥ÐԵĻ°£¬ÄãÒ²ÐíÒѾÌý¹ýJavaScriptµÄʼþ´úÀí£¨event delegation£©ÁË£¬²¢ÇÒ»á¾õµÃÖ»ÓÐÄÇЩţ±ÆºæºæµÄJavaScript³ÌÐòÔ±²Å»á¹ØÐÄÕâÑù¸´ÔÓµÄÉè¼Æģʽ¡£ÊÂʵÉÏ£¬Èç¹ûÄãÒѾ֪µÀÔõôÑùÈ¥Ìí¼ÓJavaScriptµÄʼþ´¦ÀíÆ÷£¨event handler£©£¬ÊµÏÖʼþ´úÀíÒ²ÊǼþÇá¶øÒ×¾ÙµÄÊÂÇé¡£
J ......
indexOf
·µ»ØÔªËØÔÚÊý×éµÄË÷Òý£¬Ã»ÓÐÔò·µ»Ø-1¡£ÓëstringµÄindexOf·½·¨²î²»¶à¡£
Èç¹ûÆäËûä¯ÀÀÆ÷ûÓÐʵÏÖ´Ë·½·¨£¬¿ÉÒÔÓÃÒÔÏ´úÂëʵÏÖ¼æÈÝ£º
Array.prototype.indexOf = function(el, start) {
var start = start || 0;
for ( var i=0; i < this.length; ++i ) {
......