ÓÃJavascriptÖÆ×÷Õ¾ÄÚËÑË÷Æ÷
ÓÃJavaScript×öµÄÕ¾ÄÚËÑË÷²»½ö±à³ÌʵÏÖ¡¢Î¬»¤ÆðÀ´ºÜ¼òµ¥£¬¶øÇÒËüÄÜÔÚ¿Í»§¶Ëä¯ÀÀÆ÷Ö±½ÓÖ´ÐУ¬ÎÞÐë·þÎñÆ÷µÄÖ§³Ö£¬Ò²¿ÉÒÔÊ¡È¥ÉêÇëÓнű¾Ö´ÐÐȨÏÞ¿Õ¼äµÄÂé·³¡£ËùÒÔ£¬Ö»ÒªÄãÔ¸Ò⶯ÊÖ£¬ÓиöÈËÖ÷Ò³¾ÍÄÜÓÐ×Ô¼ºµÄÕ¾ÄÚËÑË÷¡£ÏÂÃæÈÃÎÒÃǹ²Í¬À´×öÒ»¸ö»ùÓÚJavaScriptµÄÕ¾ÄÚËÑË÷µÄ½Å±¾£¬¿É²»ÒªÐ¡¿´Ëü£¬×öÍêÁËÄã¾ÍÖªµÀËüµÄºÃ´¦ÁË¡£
Ê×ÏÈ£¬ÄãÒª±àдһ¸öËÑË÷±íµ¥£¬½«Óû§ÒªËÑË÷µÄÊý¾ÝÌá½»¸øJavaScriptº¯Êý¡£×î¼òµ¥µÄ´úÂëÈçÏ£¬ÒòΪÊÇ×î¼òµ¥µÄHTML´úÂ룬ËùÒԾͲ»×÷½âÊÍÁË£º
<form name="search" onsubmit="goSearch(this)">
<input type="text" size="22" name="searchStr" value="¶à¸ö¹Ø¼ü×ÖÇëÒÔ¿Õ¸ñ¸ô¿ª" onmouseover="this.focus()" onfocus="this.select()">
<select name="select" size="1">
<option selected>»òÕß(or)</option>
<option>²¢ÇÒ(and)</option>
<option selected>²»°üº¬(no)</option>
</select>
<input type="submit" name="submit" value="ËÑË÷">
</form>
Æä´Î£¬Òª¶ÔÄãµÄÕ¾µãµÄÊý¾Ý³õʼ»¯¡£ÕâÊÇËÑË÷ʱҪÓõ½µÄÊý¾Ý¿â£¬Õ¾µã¸üÐÂÖ»Òª¸ü¸ÄÕâЩÊý¾Ý¾ÍÐÐÁË¡£¶ÔÓÚÕâ¸öÊý¾Ý¿â£¬½¨Òéµ¥¶À´æΪһ¸öÎļþ£¬ÔÚÕâÀïÎÒÃÇÏÈ´æΪÏàͬ·¾¶ÏµÄ"db.js"
/* Õ¾µãÊý¾Ý¿âdb.js¿ªÊ¼ */
function initArray(){ /* ¶¨ÒåÊý×é³õʼ»¯º¯Êý */
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++) this[i]=initArray.arguments[i];
}
/* ¶¨Òå´ýËÑË÷µÄÒ³ÃæµÄ±êÌ⣬ûÓÐÏȺó˳Ðò£¬Ó¦½«´ýËÑË÷µÄÒ³Ã涼Áгö */
var titles=new initArray('Ò³Ãæ±êÌâ1','Ò³Ãæ±êÌâ2',……);
/* ÕâЩҳÃæµÄÏêϸ˵Ã÷£¬Î»ÖÃÓ¦¸ÃÓëËüÃǵıêÌâÒ»Ö */
var descriptions=new initArray('Ïêϸ˵Ã÷1','Ïêϸ˵Ã÷2',……);
/* ´ýËÑË÷Ò³ÃæµÄµØÖ·£¬½¨ÒéʹÓÃÔÚÄãÕ¾µãÉϵÄÏà¶ÔµØÖ·£¬Î»ÖÃÒ²Ó¦Óë±êÌ⡢˵Ã÷ÏàÒ»Ö */
var URLs=new initArray('url1','url2',……);
/* Õ¾µãÊý¾Ý¿âdb.js½áÊø */
¼ÆËã»úµç×ÓÊé¼®
µÚÈý²½£¬³õʼ»¯Óû§ÊäÈëµÄËÑË÷×Ö·û´®£¬²¢½«Ëü´«µÝ¸øËÑË÷º¯Êý£¬Áгö½á¹û¡£
function goSearch(){
var searchStr=document.search.searchStr.value; /* È¡µÃ±íµ¥ÖеÄÓû§ÊäÈëµÄËÑË÷×Ö·û */
var string1=searchStr.toLowerCase(); /* ת»»ÎªÐ¡Ð´£¬±ÜÃâ´óСдÃô¸Ð */
var length1=st
Ïà¹ØÎĵµ£º
Ò³Ã棺
<script type="text/javascript" src="js/test.js"></script>
¡£¡£¡£¡£
<body onload="new myTest();" >
ÒÔ¶ÔÏó·½Ê½µ÷ÓÃÐèҪʹÓà new ²Ù×÷·û£¬test.jsµÄÄÚÈÝ:
{ & ......
JavaScript--ÕýÔò±í´ïʽ
ÕýÔò±í´ïʽ(regular expression)¶ÔÏó°üº¬Ò»¸öÕýÔò±í´ïʽģʽ(pattern)¡£Ëü¾ßÓÐÓÃÕýÔò±í´ïʽģʽȥƥÅä»ò´úÌæÒ»¸ö´®(string)ÖÐÌض¨×Ö·û(»ò×Ö·û¼¯ºÏ)µÄÊôÐÔ(properties)ºÍ·½·¨(methods)¡£
ÕýÔò±í´ïʽ¹¹Ô캯Êý£º new RegExp("pattern"[,"flags"]);
²ÎÊý˵Ã÷£º
pattern -- Ò»¸öÕýÔò±í´ïʽÎı¾
flag ......
ѧϰÁ˽âÁËjavascriptµÄһЩԪËضÔÏóµÄ´´½¨£¬»ñÈ¡µÈ¡£ÏÖÔÚµÄѧϰÖ÷ÒªÊÇÉæ¼°ÔÚ±àдjavascriptµ±ÖÐÓ¦¸Ã×¢ÒâµÄһЩϸ½Ú£º
1 ×¢Òâ±äÁ¿µÄ±àдÕýÈ·
2 ²ÎÊý´«µÝ³öÏÖÎÊÌâ »òÕß²»´æÔÚÒ²»áµ¼Ö³ö´í
3 js´íÎóµÄ¿ØÖƺ¯Êý window.onerror£ºÆ佫»á´øÈý¸ö²ÎÊýÐÅÏ¢ ¿Éͨ¹ý²ÎÊýÊý×é arguments »ñÈ¡ÐÅÏ¢ ´íÎóÐÅÏ¢£¬´íÎóÒ³ÃæµÄurlºÍ´í ......
function sAlert(msg,boxtype,func,msgtitle)
sAlert('ÐÅÏ¢ÄÚÈÝ',1,'','ÐÅÏ¢±êÌâ')
@msg:ÌáʾÐÅÏ¢ÄÚÈÝ
@boxtype£º1Ϊµ¯³ö¿ò£¬2ΪȷÈÏ¿ò£¬3ΪÌáʾ¿ò
@func:µãÈ·ÈÏʱִÐеĺ¯Êý
@title:ÐÅÏ¢¿ò±êÌâÎÄ×ÖÄÚÈÝ
Ö»ÓÐmsgÊDZØÐëµÄ£¬ºóÃæµÄ²ÎÊý¿ÉÒÔÊ¡ÂÔ¡£Èç¹ûÖмäµÄ²ÎÊýΪ¿ÕÔòÔÚ¶ÔӦλÖÃÉÏ''»òÕß""±íʾ£¨¸ù¾Ýʵ¼ÊÇé¿öÑ¡Ôñµ ......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_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">
<head ru ......