ѹËõjavascriptºÍcss
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: name-x.y.x.min.js
Step 3: Compress a JavaScript
Usage: java -jar yuicompressor-2.4.2.jar myfile-x.y.z.js -o myfile-x.y.z.min.js
java -jar yuicompressor-x.y.z.jar [options] [input file]
Global Options
-h, --help Displays this information
--type <js|css> Specifies the type of the input file
--charset <charset> Read the input file using <charset>
--line-break <column> Insert a line break after the specified column number
-v, --verbose Display informational messages and warnings
-o <file> Place the output into <file>. Defaults to stdout.
JavaScript
Ïà¹ØÎĵµ£º
1¡¢ÔËËã·û++ΪÀÛ¼Ó£¬Èôx=5£¬y=++x£¬Ôòy=6£»ÔËËã·û- -ΪµÝ¼õ£¬Èôx=5£¬y=--x,Ôòy=4
2¡¢Ìõ¼þÔËËã·û£ºgreeting=(visitor= =”PRES”)?”Dear President”:”Dear”;
Èç¹û±äÁ¿visitorÖеÄÖµÊÇ“PRES”£¬ÔòÏò±äÁ¿greeting¸³Öµ“Dear President”,·ñÔò¸³Öµ“Dear” ......
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ͼƬÅÜÂíµÆ</title>
</head>
<body>
<div align="center" id="demo" style="overflow: hidden; height: 33px; width: 400px;
&nb ......
1.»ñÈ¡URL
»ñÈ¡urlµÄ·½·¨£¬Ö±½ÓÓÃlocation¾Í¿ÉÒÔÁË£¬window.location»òwindow.loation.hrefÒ²¿ÉÒÔ¡£
2.·ÖÎöURL
ÔËÓÃlocation»ñÈ¡µÄurlµÄÊôÐÔΪobject£¬Òª¶ÔÆä½øÐÐ×Ö·û´®µÄ·ÖÎö²Ù×÷£¬ÐèÒªÏȽ«Æäת»»Îª×Ö·û´®¡£
ÓÃlocationÀ´½øÐд¦Àí£¬Ê×ÏȽ«Æäת»»Îª×Ö·û´®£¬Óú¯ÊýtoString()£¬URL.toString();
¸½Ò»Ð©URL²ÎÊý
ÍêÕûµÄU ......
ZendStudioÖа²×°JSEclipse²å¼þ
Help -> Install New SoftWare
Work with: add
name:JSEclipse Location:
http://download.macromedia.com/pub/labs/jseclipse/autoinstall
°²×°Íê³ÉºóÅäÖãº
ÐèÒª¸æËß Eclipse ËüÓÐÒ»¸ö JavaScript ÎļþµÄרÓÃ±à¼Æ÷£¬ÕâÑùËüÓÃÎĽ«²»Ê¹ÓÃͨ±¾±à¼Æ ......
JavaScriptÓµÓÐÄÚÖöÔÏóºÍ×Ô¶¨Òå¶ÔÏó£¬ÊÂʵÉϸ÷ÖÖÊý¾ÝÀàÐ͵ıäÁ¿¶¼ÊôÓÚÒ»ÖÖ¶ÔÏ󣬱äÁ¿ÔÚÉùÃ÷ºÍ¸³ÖµºóÂíÉÏÓµÓжÔÓ¦µÄ·½·¨ºÍ¶ÔÏó¡£
¡¡¡¡1.JavaScriptÄÚÖöÔÏóµÄÖÖÀà
¡¡¡¡JavaScript¶ÔÏóÒÀÕÕ½¨Á¢·½Ê½²»Í¬¿É·ÖΪʹÓñäÁ¿ÉùÃ÷µÄÒþÐÔ¶ÔÏóºÍʹÓÃnewÃüÁî¶ÔÁ¢¶ÔÏ󸱱¾µÄÏÔÐÔ¶ÔÏó¡£
¡¡¡¡
¡¡¡¡ÒþÐÔ¶ÔÏó(Implicit[im'plisit] Object ......