javascript¼¼ÇÉ
1¡¢×Ö·û´®×ª»»ÎªÊýÖµ
³£¹æ·½·¨£º
JScript code
var a = parseFloat("12");
var b = parseInt("34");
¿ÉÒÔÓÃ
JScript code
var a = +("12");
var b = +("34");
2¡¢¶àάÊý×é
³£¹æ·½·¨£º
JScript code
var A = new Array(2);
A[0] = new Array(2);
A[1] = new Array(2);
A[0][0] = 1;
A[0][1] = 2;
A[1][0] = 2;
A[1][2] = 2;
¿ÉÒÔÀûÓöÔÏóµÄÊôÐÔÇáËÉʵÏÖ
JScript code
var A = {};
A[[0, 0]] = 1;
A[[0, 1]] = 2;
A[[1, 0]] = 3;
A[[1, 2]] = 4;
3¡¢±éÀúÕýÔò½á¹û
³£¹æ·½·¨£º
JScript code
var str = "a1b2c3d4e5f6g7h8i9j0k";
var match = str.match(/\d/g, str);
var msg = [];
for(var i = 0; i < match.length; i++) {
msg.push(match[i]);
}
alert(msg);
¿ÉÒÔÀûÓÃString.replace·½·¨
JScript code
var str = "a1b2c3d4e5f6g7h8i9j0k";
var msg = [];
str.replace(/\d/g, function() {
msg.push(arguments[0]);
});
alert(msg);
´ó¼Ò×Ô¼ºÓÖʲô·¢ÏÖ»¶Ó½»Á÷¡£
--- ¥ϲ¹³äºÍÌÖÂÛ»ã×Ü ---
22Â¥cuixiping
Èç¹ûÈ·Ðècopyµ½Ò»¸öÆÕͨÊý×飬Ҳ¿ÉÒÔ¸ü¼òµ¥ÓÐЧµÄʵÏÖ£º
JScript code
var str = "a1b2c3d4e5f6g7h8i9j0k";
var msg = str.replace(/\D/g,'').split('');
alert(msg);
ÎÒÒ²¾ÙÒ»¸öÆæÒùÇɼ¼£º
ÕûÊýÇ°²¹0
ÍøÉÏËѵı¿·½·¨£º
JScript code
function pad(num, n) {
var len = num.toString().length;
while(len >>È¡Õû
JScript code
var test = 3.45;
alert(test>>>0);
Ïà¹ØÎĵµ£º
<html>
<body>
<mce:script language=javascript><!--
todayDate = new Date();
date = todayDate.getDate();
month= todayDate.getMonth() +1;
year= todayDate.getYear();
document.write("½ñÌìÊÇ")
document.write("<br>")
if(navigator.appName == "Netscape")
{
document.w ......
1£®ÔÚCOM×é¼þÖе÷ÓÃJavaScriptº¯Êý
// Á¬½Óµã·½Ê½Ò³Ãæjavascript½Å±¾
<object classid="CLSID:B568F111-DFE4-4944-B67F-0728AB2AB30F"
id="testCom" VIEWASTEXT></object>
<script language="JavaScript" for="testCom" event="staTe(s)">
&nbs ......
ÐèÒªÁ˽âµÄHTML֪ʶ
±êÇ© table,tr,th,td
ÓÃÑ»·½øÐÐÖظ´²Ù×÷
for(;;){}
javascript×Ö·û´®
ÔÚjavascriptÖУ¬µÚÒ»¸ö×Ö·ûÔÚλÖÃ0ÉÏ¡£cat£¬cÔÚλÖÃ0ÉÏ£¬aÔÚλÖÃ1É ......
ÎÒÃǾ³£ÐèÒªÔÚJavaScriptÖиøElement¶¯Ì¬Ìí¼Ó¸÷ÖÖÊôÐÔ£¬Õâ¿ÉÒÔͨ¹ýʹÓÃsetAttribute()À´ÊµÏÖ£¬Õâ¾ÍÉæ¼°µ½ÁËä¯ÀÀÆ÷µÄ¼æÈÝÐÔÎÊÌâ¡£
setAttribute(string name, string value)£ºÔö¼ÓÒ»¸öÖ¸¶¨Ãû³ÆºÍÖµµÄÐÂÊôÐÔ£¬»òÕß°ÑÒ»¸öÏÖÓеÄÊôÐÔÉ趨Ϊָ¶¨µÄÖµ¡£
1¡¢ÑùʽÎÊÌâ
setAttribute(class, value)ÖÐclassÊÇÖ¸¸Ä±äclassÕâ¸öÊôÐ ......
JavaScript ÊÇÒ»¿îÇ¿´óµÄ¹ã·ºÔËÓÃÓÚÏÖ´úWebÕ¾µã¼°Ó¦ÓõĽű¾ÓïÑÔ¡£×÷Ϊһ¸ö¼¼ÒÕ¾«Õ¿µÄ Web ¿ª·¢Õߣ¬ÕÆÎÕJavaScript¿ÉÒÔÔöÇ¿Óû§µÄʹÓÃÌåÑ飬Ìṩ½»»¥¼°¸»¿Í»§¶ËµÈ¹¦ÄÜ¡£
¾¡¹ÜJavaScript µÄÓï·¨·Ç³£¼òµ¥£¬µ«¶ÔÓÚд³ÌÐò¶øÑÔÈÔÈ»ÊÇÀ§ÄÑÖØÖØ£¬¾ÍÊÇÒòΪËüµÄÔËÐл·¾³£º»ùÓÚWebä¯ÀÀÆ÷¡£
ÒÔÏÂÄú¿ÉÒÔ¿´µ½ÊÕ¼¯µÄ8¸öʵÓÃµÄ JavaScrip ......