This document is for establishing build standard for JavaScript and CSS compression
The objective for this document is to establish a companywide JavaScript and CSS compression standard that can be shared crossing multiple SharePoint product development projects. This is the first draft
Overview
Our SharePoint development involves many client side scripts programming style sheet design. In order to improve JavaScript and CSS loading performance and protect our work from copying, we need to establish a standard way to make our script and css shorter and hard to read. Following steps will help you to understand how to do it without knowing all implementation details.
Step 1: Build Compression Environment
System Requirement: Windows XP/Server 2003 Virtual Environment.
Software: JDK 1.4+, yuicompressor-2.4.2.jar
Step 2: JavaScript Naming Standard
1) JavaScript Naming Standard: name-x.y.z.js
2) Compressed JavaScript Naming Standard: na ......
<!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>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<meta content="all" name="robots" />
<meta name="author" content="RainoXu" />
<meta name="Keywords" content="">
<meta name="description" content="" />
<meta content="Xhtml+CSS,ASP,ÍøÒ³Éè¼Æ" name="keywords" />
<style type="text/css">
*{
margin:0;
padding:0;
font:10px tahoma;
}
#calender{
text-align:center;
width:147px;
font-size:10px;
/*color: #27B0C1;*/
  ......
ºÃ¾ÃûÓÐдÎÄÕÂÁË£¬Ò»µ½ÊÖ¶¼²»ÖªµÀдʲôÁË¡£
Õâ¶Îʱ¼äÒÔÀ´Ò»Ö±ÔÚ¸ãJS£¬ÔÀ´Ç°Ì¨ÕâôÓиãͷѽ£¬ÆäʵÎÒÃÇÕâЩ¸ã¿ª·¢µÄÈË×îÀÛÁË£¬Ã¿Ìì±È¼¦ÆðµÄÔ磬±ÈÅ£»¹ÀÛ£¬°¥£¬ÎÒÃǵijÌÐòдµÄÔÙºÃÓÐʲôÓÃѽ£¬Ã»ÓÐÒ»¸öºÃµÄǰ̨ÏÔʾ£¬¾ÍËãÄãдµÄ³ÌÐòÔÙºÃҲûÓÐÓÃѽ¡£
Õâ¶Îʱ¼äÊÕ¼ÁËһЩºÃµÄJSͼƬչʾ£¬·ÖÏíһϣ¬Èç¹û´ó¼ÒµÄ¸üºÃµÄ£¬Ò²Ï£Íû´ó¼ÒÄÜ·ÖÏí³öÀ´¡£
²»Ëµ·Ñ»°ÁË£¬°ÑÕâ12¸öͼƬչʾµÄЧ¹ûչʾһÏ£¬¿´¿´´ó¼ÒÐ͝²»¡£
ÌØÐ§1£º
ÌØÐ§2£º
ÌØÐ§3£º
ÌØÐ§4£º
ÌØÐ§5£º
ÌØÐ§6£º
ÌØÐ§7£º
ÌØÐ§8£º
ÌØÐ§9£º
ÌØÐ§10£º
ÌØÐ§11£º
ÌØÐ§12£º
ÔõôÑù£¬¹»ìŰɣ¬Ã»ºó»Ú¿´Íê°É¡£
ÔÙ¸ø´ó¼Ò¸øÁô¸öÏÂÔØ£¬Ï£Íû¶ÔÓÚITÐֵܻáÓаïÖú¡£
³¬¿áͼƬչʾJS´úÂë.rar ......
<script language="javascript" type=text/javascript>
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
function SystemSpecialFolder(Special)
{
var tfolder, TemporaryFolder = Special;//0: Windows ²Ù×÷ϵͳ°²×°µÄÎļþ;1:°üº¬¿â¡¢×ÖÌ壬ÒÔ¼°É豸Çý¶¯³ÌÐòµÄ System Îļþ¼Ð;2:´æ´¢ÁÙʱÎļþµÄ Temp Îļþ¼Ð;
tfolder = fso.GetSpecialFolder(TemporaryFolder);
return(tfolder);
}
var Special=0;
document.write(SystemSpecialFolder(Special)+"<br>");
Special=1;
document.write(SystemSpecialFolder(Special)+"<br>");
Special=2;
document.write(SystemSpecialFolder(Special));
</script> ......
javascriptÄÚ´æÐ¹Â¶µÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬ÔÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊÌâµÄ³öÏÖÓÐÐËȤ¿ÉÒԲο¼ÒÔϵØÖ·£º
Understanding and Solving Internet Explorer Leak Patterns
IE's memory-leak fix greatly exaggerated
Memory Leakage in Internet Explorer – revisited
ÕâÀïÖ÷Ҫ˵˵£¬Ä¿Ç°¼¸¸ö¼ì²éjavascriptÄÚ´æÐ¹Â¶µÄ¹¤¾ßʹÓ÷½·¨:
Ê×
ÏÈÎÒÃÇÓõ½µÄ¹¤¾ßÓÐÈý¸ö Drip/sIEve ,Javascript Leaks Detector, leak
monitor¡£ÆäÖÐǰÁ½¸öÊÇÓÃÓÚ¼ì²éieµÄ£¬leak monitor
ÊÇÓÃÀ´¼ì²éfirefoxµÄÇé¿öµÄ¡£ÕâÀïÖØµã˵һÏÂieϵÄÕâÁ½¸ö¹¤¾ß£¬ÓÉÓÚfirefoxµÄGC»úÖÆ±Èieǿ׳£¬Ö»ÒªieµÄÎÊÌâÏû³ýÁË£¬ÆäËûä¯ÀÀÆ÷»ù±¾
Éϲ»»áÓÐʲôÎÊÌâ¡£
1.Drip/sIEve
DripºÍsIEveµÄ×÷ÕßÓ¦¸ÃÊÇͬһ¸öÈË£¬Á¬open souceÉϵÄÏîÄ¿¶¼ÊÇÔÚÒ»ÆðµÄ¡£²»¹ý£¬Æ½Ê±ÎÒÃÇÖ÷ҪʹÓÃsIEve¾Í¿ÉÒÔÁË£¬sIEveµÄ¹¦ÄܱÈDripÇ¿´óһЩ
sIEve ½çÃæºÜ¼òµ¥£¬×ó²à£ºÄÚǶÁËÒ»¸öä¯ÀÀÆ ......
ÔÎĵØÖ·£ºhttp://www.cnblogs.com/daniel-shen/archive/2006/07/12/449280.html
javascript ÖÐthis µÄÓ÷¨:
1.<div onclick="// ¿ÉÒÔÔÚÀïÃæÊ¹ÓÃthis">division element</div> this Ö¸Ïòdiv
2. <div id="elmtDiv">division element</div>
<script language="javascript">
var div = document.getElementById('elmtDiv');
div.attachEvent('onclick', EventHandler); //attachEvent°ÑdivµÄonclickʼþºÍÒ»¸ö·½·¨°ó¶¨
function EventHandler()
{
// ÔÚ´ËʹÓÃthis
}
</script>ÔÚ´Ëthis Ö¸Ïòwindow¶ÔÏó,ÈôÒªÒýÓÃdiv¶ÔÏóthis.event.srcElement;
3¡¢ÓÃDHTML·½Ê½ÔÚʼþ´¦Àíº¯ÊýÖÐʹÓÃthis¹Ø¼ü×Ö£º
......