javascript °ü¹ü½Úµã
Ä£·ÂjQuey£¬´´½¨¼¸¸ö°ü¹ü½ÚµãµÄ·½·¨£¬·¢ÏÖjQueryµÄ·½·¨ºÜµÍЧ°¡£¬ÏÂÒ»´ÎËûÓÖ¿ÉÒÔ˵Õ⼸¸ö·½·¨¿ÉÒÔÌáÉýÁ˶àÉÙ¶àÉÙÁË¡£ÔÀí»ù±¾ÊÇÕâÑù£¬Èç¹û´«ÈëµÄÊÇ×Ö·û´®£¬ÄÇôÈÃËüÃDZä³ÉÒ»¸öÔªËؽڵ㣬²»¹ýÕâÔªËؽڵãÒ²¿ÉÒÔÓÐÐí¶à²ã£¬ÔÚ×îÄÚ²ã°ÑÒª°ü¹üµÄÔªËطŽø¡£°Ñ×Ö·û´®±ä³ÉÔªËؽڵãµÄ·½·¨ÓÐÈçϼ¸¸ö¡£1£¬createElement£¬IE¿ÉÒÔÁ¬ÔªËØÊôÐÔÒ²Ò»Æð´´½¨£¬µ«Ö»ÄÜ´´½¨Ò»²ã¡£2£¬innerHTML£¬²»¹ýÐèÒª¶ÔÔÀ´µÄ×Ö·û´®½øÐд¦Àí£¬IEÓëFF¶¼ÓÐÐí¶àÒâÏë²»µ½µÄĬÈÏÐÐΪ£¬¿ÉÒÔΪÄã¶à¼ÓÒ»µã¶«Î÷»òÉÙ¼ÓÒ»µã¶«Î÷¡£3£¬createContextualFragment£¬ÓÉÓÚOperaµÄÐÐΪÓеã¹ÖÒ죬ÐèҪѡÖÐÐÞ¸ÄÔªËصÄλÖ᣾ÈÕ±¾È˵IJâÊÔ£¬Ëüת»»×Ö·û´®³É½ÚµãµÄЧÂʱÈinnerHTML¸ß¶àÁË£¬Ò²°²È«¶àÁË£¬ÕæÊÇÇ¿ÕßÓúÇ¿£¬ÈõÕßÓúÈõ¡£Èç¹ûÊÇ´«ÈëÔªËؽڵ㣬ÐèÒª¿Ë¡һÏ£¬Òª²»¶¼±ä³ÉwrapAll¡£Èç¹ûÊǺ¯Êý£¬°Ñµ±Ç°ÔªËØ´«½øÈ¥£¬ÀûÓÃËüµÄijЩÊôÐÔ´´½¨Ò»¸ö°ü¹üÔªËØ¡£
×î³õµÄʵÑéÆ·£¨ÕâÀïµÄwrapOuterÏ൱ÓÚjQueryµÄwrap£©£º
var parseHTML = function(str) {
if(document.createRange){
var range = document.createRange()
range.setStartAfter(document.body)
return range.createContextualFragment(str)
}else{
return document.createElement(str)
}
}
var wrapOuter = function(target,html){
var wrap = parseHTML(html) ;
target.parentNode.insertBefore(wrap,target);
target.previousSibling.appendChild(target)
}
<!doctype html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="utf-8"/>
<meta content="IE=8" http-equiv="X-UA-Compatible"/>
<style type="text/css">
.wrapper {
margin: 5px 5px 5px 5px;
padding: 5px 5px 5px 5px;
background-color:#dfe8f6;
border: 1px solid magenta;
}
.inner{
margin:1em;
height:20px;
background:#a9ea00
}
.border{
border:2px solid red;
}
</style>
<title>°ü¹ü½Úµã by ˾ͽÕýÃÀ</title>
<script type="text/javascript">
window.onload = func
Ïà¹ØÎĵµ£º
JavaScript½Ì³ÌÓïÑԸſö
Internetʱ´ú£¬Ôì¾ÍÁËÎÒÃÇÐµĹ¤×÷ºÍÉú»î·½Ê½£¬Æ以ÁªÐÔ¡¢¿ª·ÅÐԺ͹²ÏíÐÅÏ¢µÄģʽ£¬´òÆÆÁË´«Í³ÐÅÏ¢
´«²¥·½Ê½µÄÖØÖرÚÀÝ£¬ÎªÎÒÃÇ´øÀ´ÁËеĻúÓö¡£Ëæ׿ÆËã»úºÍÐÅϢʱ´úµÄµ½À´£¬ÈËÀàÉç»áÇ°½øµÄ½Å²½ÔÚÖ𽥼ӿ죬ÿһÌ춼ÓÐеÄÊÂÇé·¢Éú£¬Ã¿Ò»Ì춼ÔÚ´´Ôì×ÅÆæ
¼£¡£Ëæ×ÅInternet¼¼ÊõµÄÍ»·ÉÃͽø£¬¸÷Ðи÷ ......
¶¨Òå±äÁ¿
var test=10;
ʹÓöÔÏóÊôÐÔ
¿ÉÒÔʹÓà . ²Ù×÷·û»ñµÃÊôÐÔ,Ò²¿ÉÒÔʹÓÃÊý×éϱê»ñµÃ,±ÈÈç
for(var prop in document)
document.write(document[prop]+"<br>");
With ÉùÃ÷¶ÔÏó,Ö®ºóÔÙÓõ½¶ÔÏó¾Í²»±ØÉùÃ÷ÁË
with(document){
write("Hello World<br>±êÌâ: ");
write(title);
}
³£ÓöÔÏó ......
JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM
API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆʦËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web Ç°¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript
ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ Java ÃüÃû£¬µ«²¢²»ÊÇ Java
Ëü×î³õ½Ð Mocha£¬ ½Óן ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charse ......
JavaScript½âÎö¶ÁÈ¡XMLÎļþ£¬Ö÷Òª¾ÍÊǼÓÔز¢½âÎöXMLÎļþ£¬È»ºó¾Í¿ÉÒÔ²âÊÔ½âÎöµÄXMLÎļþµÄÄÚÈÝ£¬´òÓ¡Êä³öÀ´¡£
±àдÁËÒ»¸öJavaScriptµÄÀàÀ´ÊµÏÖ¶ÁÈ¡Ò»¸öXMLÎļþÖеÄÊý¾Ý£¬ÊµÏÖ´úÂëÈçÏÂËùʾ£º
<mce:script type="text/javascript"><!--
/**
* @author Shirdrn
*/
function XMLDoc(){}; // ¶¨ÒåÒ»¸öXM ......