javascript¶¯Ì¬Ìí¼Ó/ɾ³ýdiv
Ìí¼Ó
<script>
var oDiv = document.createElement("DIV");
oDiv.id = "shop01";
oDiv.style.top = 200;
oDiv.style.left = 200;
oDiv.style.background = '#FFFF00';
oDiv.style.visibility = 'visible';
oDiv.innerHTML="123123"
document.body.appendChild(oDiv);
oDiv.onclick = abc;
function abc(){
alert("abc");
}
</script>
ɾ³ýdiv:
function deldiv(divid){
var div=document.getElementById(divid);
div.parentNode.removeChild(div);
}
Áí£º
»ñµÃÒ»¸ö¿Ø¼þvar xxoo = document.createElement('xxoo');
ÉèÖÃÊôÐÔ
È»ºó¿ÉÒÔ»ñµÃÒ»¸ödivµÄ¿Ø¼þÈ»ºódiv.appendChild(xxoo);
Ïà¹ØÎĵµ£º
JavaScriptÀï×Ö·û´®ÀàÐÍת»»³ÉÈÕÆÚÀàÐÍ£º
Èç¹û×Ö·û´®ÖÐÓпոñ»òÊÇÆäËû·Ö¸î·û·Ö¸î£¬¿ÉÒÔÓÃsplit·½·¨ÏȲð·Ö£¬·µ»ØÒ»¸öÊý×飬ÔÙ°ÑÕâ¸öÊý×éÀïµÄÄêÔÂÈÕ×÷Ϊ²ÎÊý´«µ½new Date()ÀïÉú³ÉÈÕÆÚÀàÐÍ£»
Èç¹ýûÓÐÌØÊâ·Ö¸ô·û£¬¿ÉÒÔÓÃsubstr£¨x£¬y£©·½·¨À´È¡×Ó×Ö·û´®À´Éú³ÉÈÕÆÚ£¬substr£¨x£¬y£©Àx±íʾȡ×Ö´®µÄ¿ªÊ¼Î»Öã¬y±íʾ×Ó´®µÄ³ ......
Ò»¡¢»ù±¾Ê¹Ó÷½·¨
prototypeÊôÐÔ¿ÉËãÊÇJavaScriptÓëÆäËûÃæÏò¶ÔÏóÓïÑÔµÄÒ»´ó²»Í¬Ö®´¦¡£
¼ò¶øÑÔÖ®£¬prototype¾ÍÊÇ“Ò»¸ö¸øÀàµÄ¶ÔÏóÌí¼Ó·½·¨µÄ·½·¨”£¬Ê¹ÓÃprototypeÊôÐÔ£¬¿ÉÒÔ¸øÀද̬µØÌí¼Ó·½·¨£¬ÒÔ±ãÔÚJavaScriptÖÐʵÏÖ“¼Ì³Ð”µÄЧ¹û¡£
& ......
JavaScript¶¯Ì¬¼ÓÔØCSSµÄÈýÖÖ·½·¨ ÊÕ²Ø
Èç¹ûÄãÓкܶà¹ØÁªµÄCSSÎļþÒªÒ»Æð¼ÓÔØ£¬»òÕßÏ붯̬µÄ¼ÓÔز»Í¬µÄCSSÎļþ£¬ÄÇôÏÂÃæµÄ·½·¨ÄãÒ»¶¨¶ÔÄãÓаïÖú¡£
µÚÒ»ÖÖ£ºÒ»°ãÓÃÔÚÍⲿCSSÎļþÖмÓÔرØÐëµÄÎļþ
³ÌÐò´úÂë
@import url(style.css);
/*Ö»ÄÜÓÃÔÚCSSÎļþÖлòÕßstyle±êÇ©ÖÐ*/
µÚ¶þÖÖ£º¼òµ¥µÄÔÚÒ³ÃæÖмÓÔØÒ» ......
(Ò»).È·ÈÏɾ³ýÓ÷¨:
1. BtnDel.Attributes.Add("onclick","return confirm('"+"È·ÈÏɾ³ý?"+"')");
2. linktempDelete.Attributes["onclick"]="javascript:return confirm('"+"È·ÈÏɾ³ý?"+"');";
3. privat ......
String.prototype.Trim=function(){
returnthis.replace(/(^\s*)|(\s*$)/g,"");
}
String.prototype.LTrim=function(){
returnthis.replace(/(^\s*)/g,"");
}
String.prototype.RTrim=function(){
returnthis.replace(/(\s*$)/g,"");
} ......