javascript ×Ö·û´®´¦ÀíÈ«¹¥ÂÔ£¨×ª£©
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 == -1)
{
alert("You loser, email addresses must
ha
Ïà¹ØÎĵµ£º
<script type="text/javascript">
function checkform() {
//ÅжϱêÌâÀ¸ÊÇ·ñÌîд
if (document.form1.title.value == "") {
alert("ÐÅÏ¢ÀàÐͲ»ÄÜΪ¿Õ£¡");
&nb ......
ÕâÊÇÒ»ÖÖºÜÓÐǰ;µÄ¼¼Êõ£¬¿ÉϧÉú²»·êʱ£¬IE¸Õ´ò¿åÍø¾°£¬»ðºüÓÖð³öÀ´ÁË¡£ÕâÖÖ¼¼ÊõÊÇÎÒÔÚÉè¼Æ³¬¼¶Êý×é¶ÔÏóʱ·¢Ïֵġ£ÓÉÓÚÖ±½Ó¼Ì³ÐÔÉúÊý×éÎÊÌâ¶à£¬ÎÒÖ»ÓÐÓÃObjectÓëArrayµÄÔÐÍ·½·¨¹¹½¨Ò»¸öÐÂÀà¡£²»ÓÃ˵£¬Ð§Âʲ»Ì«ÀíÏë¡£Ö±µ½ÎÒÒѰѳ¬¼¶Êý×éÕéÖÁÍêÃÀµÄ½ñÌ죬ÎÒ»¹ÔÚ²»¶ÏÑ°ÕÒеÄÌæ´ú·½°¸£¬ÓÚÊÇÎÒ¾ÍÏëµ½ÓÃÁíÒ»¸öÎĵµµÄÊý×é¶ÔÏóÀ ......
ÒýÓÃ
Aaron µÄ javascript¶¨Òå¶ÔÏóд·¨£¨ÕûÀí£©
javascript¶¨Òå¶ÔÏóµÄ¼¸ÖÖ¼òµ¥·½·¨
1.¹¹Ô캯Êý·½Ê½£¬È«²¿ÊôÐÔ¼°¶ÔÏóµÄ·½·¨¶¼·ÅÔÚ¹¹Ôì·½·¨ÀïÃ涨Òå
Óŵ㣺¶¯Ì¬µÄ´«µÝ²ÎÊý
ȱµã£ºÃ¿´´½¨Ò»¸ö¶ÔÏó¾Í»á´´½¨ÏàͬµÄ·½·¨º¯Êý¶ÔÏó£¬Õ¼ÓôóÁ¿ÄÚ´æ
function User1(name, password) {
this.name = name;
this.password = pass ......
WEB ±à³Ì - DHTML - ʼþ
onabort
µ±Í¼Æ¬¼ÓÔر»ÖжÏʱ´¥·¢µÄʼþ
onactivate
µ±¶ÔÏó³ÉΪ»îÐÔÔªËØʱ´¥·¢µÄʼþ
onafterprint
µ±ÍøÒ³´òÓ¡½áÊøʱ´¥·¢µÄʼþ
onafterupdate
µ±¶ÔÏóµÄÊý¾Ý±»³É¹¦ÐÞ¸ÄÖ®ºó¶ø´¥·¢µÄʼþ
onbeforeactivate
µ±¶ÔÏó½«Òª±»ÉèÖóɻԪËØ֮ǰ´¥·¢µÄʼþ
onbeforecopy
µ±ÍøÒ³±»¿½±´Ö®Ç°¶ø ......
Javascript´úÂëÊղشóÈ«
1. oncontextmenu="window.event.returnvalue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="retu ......