javascript ¶¯Ì¬²åÈëÐÐ ±í¸ñ²Ù×÷
<script>
var i = 0;
function insertTr(obj)
{
var tr1 = tb.insertRow(obj.rowIndex+1);
var td1 = tr1.insertCell();
td1.innerHTML = "newCell" + i;
i += 1;
}
</script>
<table id=tb>
<tr onclick="insertTr(this)">
<td>2</td>
</tr>
<tr onclick="insertTr(this)">
<td>1</td>
</tr>
</table>
±í¸ñ²Ù×÷Àà(Ìí¼Ó£¬É¾³ý£¬ÅÅÐò£¬ÉÏÒÆ£¬ÏÂÒÆ)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">*{font-size:14px}button{margin:3px}</style>
<script type="text/javascript">
var mytable=null,mytable2=null;
window.onload=function(){
mytable=new CTable("tbl",10);
mytable2=new CTable("tbl2",6);
}
Array.prototype.each=function(f){for(var i=0;i<this.length;i++) f(this[i],i,this)}
function $A(arrayLike){
for(var i=0,ret=[];i<arrayLike.length;i++) ret.push(arrayLike[i]);
return ret
}
Function.prototype.bind = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
function CTable(id,rows){
this.tbl=typeof(id)=="string"?document.getElementById(id):id;
if (rows && /^\d+$/.test(rows)) this.addrows(rows)
}
CTable.prototype={
addrows:func
Ïà¹ØÎĵµ£º
Èç¹ûÄú»¹Ã»ÓÐÔĶÁ¡¶JavaScriptµ÷ÊÔ¼¼ÇÉÖ®£º¿ìËÙ¶¨Î»¡·£¬½¨ÒéÏÈ¿´¿´ÄÇÆª¡£Ëµ²»¶¨£¬ÓÿìËÙ¶¨Î»¾ÍÄܽâ¾öÎÊÌâÁË£¬ºÇºÇ¡£Õâ´ÎÎÒ»á×ܽá¼Ç¼һ϶ϵãµ÷ÊԵıʼǣ¬Ï£ÍûÒ²¶Ô´ó¼ÒÓÐÓ㬻¶Ó²¹³ä½»Á÷£¡
Ê×ÏÈ£¬ÔÚ¸÷¸öä¯ÀÀÆ÷ÖУ¬¶Ïµãµ÷ÊÔÖ§³ÖµÄ×îºÃµÄµ±È»ÊÇFirefox£¬Firefox²»½ö¿ÉÒÔʹÓÃFirebugµ÷ÊÔÒ³Ãæjs½Å±¾£¬»¹¿ÉÒÔÓø߼¶µ÷ÊÔ¹¤¾ßÀ ......
Ò»¶ÎJavaScript½Å±¾³ÌÐò£¬¸ºÔð¹Ø±Õ´°¿Ú£¬Èç¹ûÍøÒ³²»ÊÇͨ¹ý½Å±¾³ÌÐò´ò¿ªµÄ£¨window.open()£©£¬µ÷ÓÃwindow.close()½Å±¾¹Ø±Õ´°¿Úǰ£¬±ØÐëÏȽ«window.opener¶ÔÏóÖÃΪnull£¬·ñÔòä¯ÀÀÆ÷£¨IE7¡¢IE8£©»áµ¯³öÒ»¸öÈ·¶¨¹Ø±ÕµÄ¶Ô»°¿ò¡£
£¼script language="javaScript"£¾
function closeWindow()
{
¡¡window.opener = null;
¡¡w ......
Evaluates an expression after a specified number of milliseconds has elapsed.
(ÔÚÖ¸¶¨Ê±¼ä¹ýºóÖ´ÐÐÖ¸¶¨µÄ±í´ïʽ)
Syntax:
iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])
Parameters
vCode
Required. Variant that specifies the function pointer or string that indicates the code to be ......
var greeting_w = {
c:['ÄãºÃ!', '»¶Ó»ØÀ´', '»¶Ó»Øµ½×éÖ¯', '×£ÄãºÃÐÄÇ飡', 'Hi~', 'Hello!', '*^o^*', ':D', 'ûʶàºÈË®', 'CR=ChinaRen', 'ÓÖ¼ûÃæÁË!', '¶àÔ˶¯ÉÙÉú²¡', '»¶ÓÀ´µØÇò~', '»¶ÓÀ´»ðÐÇ~', 'ÄãÌ«ÓвÅÁË!', 'hoho', 'ûʳԸöË®¹û', 'À´ºß¸ö¸è¶ù', '²ðÄÉÈÊ»¶ÓÄã!', 'ÏëtaÁËÂð?', 'ɶʱͬѧ»á?', '±£»¤º ......