ã¯ããã«
ãAjaxã®ç»å ´ã«ããJavaScriptã¸å¤ãã®Webéçºè ã®æ³¨ç®ãéã¾ã£ã¦ä»¥éãJavaScriptã¯ãã¯ã¼ã«ãªWebãã¼ã¸ãä½ãä¸ã§ãªãã¦ã¯ãªããªããã®ã¨ãªã£ã¦ãã¦ãã¾ããç¹ã«ããã¸ã¥ã¢ã«ãªè¡¨ç¤ºãå¹æãå®ç¾ããããã«ã¯ãJavaScriptã¯ä»ãä¸å¯æ¬ ã®ãã®ã¨ãã£ã¦ããã§ãããã以åã¯ããããããã®ãJavaScriptã§å®è£ ããã«ã¯æ°ã®é ããªãã³ã¼ãã£ã³ã°ãå¿ è¦ã§ããããç¾å¨ã¯å¤æ°ã®JavaScriptã©ã¤ãã©ãªãç»å ´ã競ãåã£ã¦ãã¾ããJavaScriptãæ軽ã«å°å ¥ããããã¨ãã人ã«ã¯å¤¢ã®ãããªæ代ã¨ãªã£ããã¨ãã£ã¦ããã§ãããã
ããããã¾ãã«å¤ãã®ã©ã¤ãã©ãªãç»å ´ãããããæããã¦ã©ãã使ãã°ããã®ããããåãããªããªã£ã¦ãã¾ã£ããã¨ãã人ãå¤ãã§ããããã¾ããæ©è½ãé«åº¦åãããã¾ãã使ãæ¹ãã²ã©ãé£ãããªã£ã¦ãã¾ã£ã¦ããã©ã¤ãã©ãªãããã¾ããæ¯è¼çç°¡åã«ããããå¹æçãªãã¸ã¥ã¢ã«ãä½æã§ããã©ã¤ãã©ãªã¯ã©ããªã®ããæ©ãã§ãã人ãå¤ãã®ã§ã¯ãªãã§ããããã
ãããã便å©ãªGUIãããã¸ã¥ã¢ã«ãæ¯æ´ããå種ã®è¦è¦å¹æãªã©ãJavaScriptã§å®ç¾ããããã¨èãã¦ãããªãããScript.aculo.usãã¯é常ã«ããé¸æè¢ã§ããæ¬è¨äºã§ã¯ãScript.aculo.usã«ç¨æããã¦ãã主ãªæ©è½ã®ä½¿ãæ¹ãç´¹ä»ããã©ãã ãæ軽ã«é«åº¦ãªGUIãå®ç¾ã§ããã®ãä½æãã¦ãããããã¨æãã¾ãã
対象èªè
- JavaScriptã§é«åº¦ãªGUIãç°¡åã«çµã¿è¾¼ã¿ããã¨æã£ã¦ãããã¶ã¤ãã
- JavaScriptã®åºæ¬ã¯åãã£ã¦ããããã©ãæ¬æ ¼çãªã³ã¼ãã£ã³ã°ã«ã¯ã¡ãã£ã¨èªä¿¡ããªãã¨ãã人ã
- JavaScriptã§ä½ãã§ããã®ããã¨ããããè¦ã¦ã¿ããã¨æã人ã
Script.aculo.usã¨ã¯ï¼
ãä»åãå©ç¨ããScript.aculo.usã¨ããã©ã¤ãã©ãªã¯ããã®åã®éãscript.aculo.usã¨ãããµã¤ãã§éçºé å¸ããã¦ããããªã¼ã®JavaScriptã©ã¤ãã©ãªã§ãããã®Script.aculo.usã¨ããã©ã¤ãã©ãªãããã¾ãèãããã¨ããªããªãã¨æã£ã人ãããããç¥ãã¾ããããRubyã®ãã¬ã¼ã ã¯ã¼ã¯ãRuby on RailsãããPHPã®ãã¬ã¼ã ã¯ã¼ã¯ãCakePHPãã¨ãã£ããã®ã§ãµãã¼ãããã¦ãããã¨ããã£ã¦ãå®ã¯æå¤ã«åºã使ããã¦ãã¾ãã
ãæ¬è¨äºå·çæç¹ã§ãææ°ãã¼ã¸ã§ã³ã¯1.8.2ã¨ãªã£ã¦ãã¾ããã¾ãã¯ããã¦ã³ãã¼ããã¼ã¸ã«ã¢ã¯ã»ã¹ããã©ã¤ãã©ãªãã¡ã¤ã«ããã¦ã³ãã¼ããã¾ãããã
ããã¼ã¸ä¸å¤®ã®ãcurrent versionããããææ°çããã¦ã³ãã¼ãã§ãã¾ããWindowsã§ã®å©ç¨ãªããZipãã¡ã¤ã«ããã¦ã³ãã¼ãããã¨è¯ãã§ãããããã¦ã³ãã¼ãããå§ç¸®ãã¡ã¤ã«ãå±éããã¨ããã©ã«ãå ã«ãsrcãã¨ãããã©ã«ããä½æããã¾ãããã®ãã©ã«ãã®ä¸ã«å ¥ã£ã¦ããJavaScriptãã¡ã¤ã«ããScript.aculo.usã®æ¬ä½ã§ãããããèªåã®Webãµã¤ãã«ã³ãã¼ããHTMLããèªã¿è¾¼ããã¨ã§ä½¿ããããã«ãªãã¾ãã
ããã ãï¼ ããã ãã§ã¯ã¾ã Script.aculo.usã¯ä½¿ãã¾ãããScript.aculo.usã¯ãå é¨ã§prototype.jsã©ã¤ãã©ãªã使ç¨ãã¦ãã¾ããå¾ã£ã¦ãprototype.jsãWebãµã¤ãã«ã³ãã¼ãã¦ãããªããã°ããã¾ãããã¨ãã£ã¦ããããããprototype.jsããµã¤ããããã¦ã³ãã¼ããã¦ããå¿ è¦ã¯ããã¾ãããScript.aculo.usã®ãã©ã«ãå ã«ãããlibããã©ã«ãã®ä¸ã«ãprototype.jsãç¨æããã¦ãã¾ããããããã®ã¾ã¾ä½¿ã£ã¦ãã ããã
ãã¡ã¤ã«ã¨ãã©ã«ãæ§æãæ´ãã
ãããã§ã¯ãä¾ã¨ãã¦Webãµã¼ãã¼ã®å ¬éãã£ã¬ã¯ããªã«ãjsappãã¨ãããã©ã«ããä½æããããã«ãã¡ã¤ã«ãé ç½®ãããã¨ã«ãã¾ãããã®ãã©ã«ãå ã«ã¯ã次ã®ãããªãã©ã«ããç¨æãã¦ããã¾ãã
ãã©ã«ã | 説æ |
ãjsããã©ã«ã | JavaScriptãã¡ã¤ã«ã®é ç½®å ´æãããã«ãScript.aculo.usã®ãã¡ã¤ã«é¡ã¨prototype.jsãé ç½®ãã¦ããã¾ãã |
ãcssããã©ã«ã | ã¹ã¿ã¤ã«ã·ã¼ãã®é ç½®å ´æã |
ãimgããã©ã«ã | ã¤ã¡ã¼ã¸ãã¡ã¤ã«ã®é ç½®å ´æã |
ãããã«ãå種ã®ãã¡ã¤ã«ãé ç½®ãã¦ãããã¨ã«ãã¾ããããã¾ãã¯ãåºæ¬ã¨ãªããã®ã¨ãã¦ããjsappãå ã«ãindex.htmlãããããã¦ãcssãå ã«ãstyle.cssããããããç¨æãã¦ãããã¨ã«ãã¾ããããããã®ãã¡ã¤ã«ã®å 容ã¯ã次ã®ããã«ãã¦ããã¾ãããã
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Script.aculo.us</title> <link rel="stylesheet" type="text/css" href="./css/style.css" /> <script type="text/javascript" src="./js/prototype.js"></script> <script type="text/javascript" src="./js/scriptaculous.js"></script> </head> <body> <h3 class="title">Script.aculo.us sample</h3> â»ãµã³ãã«ã®index.htmlãããã«è©¦é¨ç¨ã®ã³ã¼ããæ¸ãã </body> </html>
@CHARSET "utf-8"; h3.title { padding-left:10px; color: #FFFFFF; background-color : #000099; }
ãScript.aculo.usãå©ç¨ããå ´åã«ã¯ã<script>
ã¿ã°ã§2ã¤ã®ãã¡ã¤ã«ãèªã¿è¾¼ã¿ã¾ãã1ã¤ã¯ãprototype.jsãããã1ã¤ã¯ãscriptaculous.jsãã§ãããã以å¤ã®JavaScriptãã¡ã¤ã«ã¯ã<script>
ã¿ã°ã§èªã¿è¾¼ãå¿
è¦ã¯ããã¾ãããã¾ããScript.aculo.usã§ã¯ãHTMLã®ã¿ã°ãå©ç¨ãã¦æ©è½ãçµã¿è¾¼ããã¨ãå¤ããããã¿ã°ã®è¡¨ç¤ºãæå®ããããã®CSSãã¡ã¤ã«ãç¨æããã®ã¯åºæ¬ã¨ãã£ã¦ããã§ãããããã¡ãã¡åã
ã®ã¿ã°ã«ç´æ¥ã¹ã¿ã¤ã«ãè¨è¿°ãã¦ããã®ã¯ããã¾ãã¹ãã¼ããªããæ¹ã¨ã¯è¨ãã¾ããããã
ãã¾ããããããæåã¨ã³ã³ã¼ãã£ã³ã°ããUTF-8ãã«è¨å®ããã¦ãã¾ãããæ¥æ¬èªãæ±ããã¨ãèããããã§ã¯ãã¹ã¦ã®ãã¡ã¤ã«ã®ã¨ã³ã³ã¼ãã£ã³ã°ãUTF-8ã§çµ±ä¸ãã¦ä½æãããã¨ã«ãã¾ãã