JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«
JavaScript·½·¨ºÍ¼¼ÇÉ´óÈ«
1£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”JavaScript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </script>
ÔÚ²»Ö§³ÖJavaScriptµÄä¯ÀÀÆ÷Öн«²»Ö´ÐÐÏà¹Ø´úÂë
3 ä¯ÀÀÆ÷²»Ö§³ÖµÄʱºòÏÔʾ
1: <noscript>
2: Hello to the non-JavaScript browser.
3: </noscript>
4 Á´½ÓÍⲿ½Å±¾Îļþ
1: <script language=”JavaScript” src="/”filename.js"”></script>
5 ×¢Êͽű¾
1: // This is a comment
2: document.write(“Hello”); // This is a comment
3: /*
4: All of this
5: is a comment
6: */
6 Êä³öµ½ä¯ÀÀÆ÷
1: document.write(“<strong>Hello</strong>”);
7 ¶¨Òå±äÁ¿
1: var myVariable = “some value”;
8 ×Ö·û´®Ïà¼Ó
1: var myString = “String1” + “String2”;
9 ×Ö·û´®ËÑË÷
1: <script language=”JavaScript”>
2: <!--
3: var myVariable = “Hello there”;
4: var therePlace = myVariable.search(“there”);
5: document.write(therePlace);
6: // -->
7: </script>
10 ×Ö·û´®Ìæ»»
1: thisVar.replace(“Monday”,”Friday”);
11 ¸ñʽ»¯×Ö´®
1: <script language=”JavaScript”>
2: <!--
3: var myVariable = “Hello there”;
4: document.write(myVariable.big() + “<br>”);
5: document.write(myVariable.blink() + “<br>”);
6: document.write(myVariable.bold() + “<br>”);
7: document.write(myVariable.fixed() + “<br>”);
8: document.write(myVariable.fontcolor(“red”) + “<br>”);
9: document.write(myVariable.fontsize(“18pt”) + “<br>”);
10: document.write(myVariable.italics() + “<br>&rdquo
Ïà¹ØÎĵµ£º
ÎÒÃÇÔÚjspÒ³ÃæÉϵÄjs½Å±¾ÖпÉÒÔµ÷ÑÐjava´úÂ룬±ÈÈ磬ÎÒÃÇÐèÒªÔÙjsÖÐÓÃalertº¯ÊýÏÔʾ·þÎñÆ÷¶Ë·¢Ë͹ýÀ´µÄij¸ö×Ö·û´®ÄÇôÎÒÃÇ¿ÉÒÔÕâÑù×ö
tomcat주
ÔÚ·þÎñÆ÷¶ËÎÒÃÇÓÐrequest.setAttribute("name","abc");
ÄÇôÎÒÒªÔÚÒ³ÃæÉÏÓÃalertÏÔʾµÄ»°£¬ÓÐÁ½ÖÖ·½Ê½£º
1¡¢Ê¹ÓÃEL±í´ïʽ
ÔÚEl±í´ïʽµÄÍâÃæÓÃÒýºÅ¼´¿É£º
<scri ......
var o = ['Äã', 'da', 'Äã', 123, 'fm', 'fm', 'da', 123, 'fm', 123];
var n = [];
var s = -1;
var t = null;
o.sort();
for(var i = 0; i < o.length; i++)
{
if(o[i] != t)
{
s += 1;
n[s] = [];
}
......
ÔÚ document ¶ÔÏóÖÐÓÐÒ»¸ö cookie ÊôÐÔ¡£µ«ÊÇ Cookie ÓÖÊÇʲô£¿“ijЩ Web Õ¾µãÔÚÄúµÄÓ²ÅÌÉÏÓúÜСµÄÎı¾Îļþ´æ´¢ÁËһЩÐÅÏ¢£¬ÕâЩÎļþ¾Í³ÆΪ Cookie¡£”—— MSIE °ïÖú¡£Ò»°ãÀ´Ëµ£¬Cookies ÊÇ CGI »òÀàËÆ£¬±È HTML ¸ß¼¶µÄÎļþ¡¢³ÌÐòµÈ´´½¨µÄ£¬µ«ÊÇ JavaScript Ò²ÌṩÁË¶Ô Cookies µÄºÜÈ«ÃæµÄ·ÃÎÊȨÀû ......
JavaScriptÀï×Ö·û´®ÀàÐÍת»»³ÉÈÕÆÚÀàÐÍ£º
Èç¹û×Ö·û´®ÖÐÓпոñ»òÊÇÆäËû·Ö¸î·û·Ö¸î£¬¿ÉÒÔÓÃsplit·½·¨ÏȲð·Ö£¬·µ»ØÒ»¸öÊý×飬ÔÙ°ÑÕâ¸öÊý×éÀïµÄÄêÔÂÈÕ×÷Ϊ²ÎÊý´«µ½new Date()ÀïÉú³ÉÈÕÆÚÀàÐÍ£»
Èç¹ýûÓÐÌØÊâ·Ö¸ô·û£¬¿ÉÒÔÓÃsubstr£¨x£¬y£©·½·¨À´È¡×Ó×Ö·û´®À´Éú³ÉÈÕÆÚ£¬substr£¨x£¬y£©Àx±íʾȡ×Ö´®µÄ¿ªÊ¼Î»Öã¬y±íʾ×Ó´®µÄ³ ......
JavaScript¶¯Ì¬¼ÓÔØCSSµÄÈýÖÖ·½·¨ ÊÕ²Ø
Èç¹ûÄãÓкܶà¹ØÁªµÄCSSÎļþÒªÒ»Æð¼ÓÔØ£¬»òÕßÏ붯̬µÄ¼ÓÔز»Í¬µÄCSSÎļþ£¬ÄÇôÏÂÃæµÄ·½·¨ÄãÒ»¶¨¶ÔÄãÓаïÖú¡£
µÚÒ»ÖÖ£ºÒ»°ãÓÃÔÚÍⲿCSSÎļþÖмÓÔرØÐëµÄÎļþ
³ÌÐò´úÂë
@import url(style.css);
/*Ö»ÄÜÓÃÔÚCSSÎļþÖлòÕßstyle±êÇ©ÖÐ*/
µÚ¶þÖÖ£º¼òµ¥µÄÔÚÒ³ÃæÖмÓÔØÒ» ......