¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS

JavaScript

Last-modified: 2018-11-14 (¿å) 15:23:53 (2214d)
Top / JavaScript

¥Æ¥ó¥×¥ì¡¼¥È

HTML 5·Á¼°¤Ç¤Á¤ç¤Ã¤È»î¤·¤¿¤¤¤È¤­¤Î¥Æ¥ó¥×¥ì¡¼¥È

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>JavaScript¥Æ¥¹¥È</title>
</head>



<body>
<script>
<!--
	document.write('Hello, world!<br>');
//-->
</script>
<noscript>JavaScript¤¬ÍøÍѤǤ­¤Þ¤»¤ó¡£</noscript>
</body> 
</html>

Ãí¡§UTF-8¤ÇÊݸ¤·¤Æ¤¯¤À¤µ¤¤

´Ê°×Ū¤ÊHTML 4·Á¼°¤Ç¤Á¤ç¤Ã¤È»î¤·¤¿¤¤¤È¤­¤Î¥Æ¥ó¥×¥ì¡¼¥È

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>JavaScript¥Æ¥¹¥È</title>
</head>



<body>
<script type="text/javascript">
<!--
	document.write('Hello, world!<br>');
//-->
</script>
<noscript>JavaScript¤¬ÍøÍѤǤ­¤Þ¤»¤ó¡£</noscript>
</body>
</html>

Ãí¡§UTF-8¤ÇÊݸ¤·¤Æ¤¯¤À¤µ¤¤
È÷¹Í¡§DOCTYPE¤òÉÕ¤±¤ì¤ÐÀµ¼°¤ÊHTML 4¤È¤Ê¤ê¤Þ¤¹

¥½¡¼¥¹µ­ÆþÊýË¡

ÊÌ¥Õ¥¡¥¤¥ë¤Ëµ­½Ò¤¹¤ëÊýË¡

HTML5

<script src="js/foo.js"></script>

HTML4.01, XHTML

<script type="text/javascript" src="js/foo.js" charset="UTF-8"></script>

¢¨Ê¸»ú¥³¡¼¥É¤¬°ã¤¦¾ì¹ç¤Ï¤³¤Î¤è¤¦¤Ëcharaset¤ò»ØÄꤷ¤Þ¤¹

HTML¥Õ¥¡¥¤¥ëÃæ¤Ë¤Þ¤È¤á¤Æµ­½Ò¤¹¤ëÊýË¡

<script type="text/javascript">
<!--
	¥³¥³¤Ë¥³¡¼¥É¤òµ­½Ò¤·¤Þ¤¹
//-->
</script>
<noscript>¤´»ÈÍѤδĶ­¤Ç¤ÏJavaScript¤¬Æ°ºî¤·¤Þ¤»¤ó¡£
¤³¤Î¥Ú¡¼¥¸¤ÏJavaScript¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤Î¤Ç¡¢°ìÉôµ¡Ç½¤ò¤´ÍøÍѤ¤¤¿¤À¤±¤Þ¤»¤ó¡£</noscript>

¥¹¥¯¥ê¥×¥È¤¬»È¤¨¤Ê¤¤¾ì¹ç¤Ï¡¢¥³¡¼¥ÉÉôʬ¤ò<!-- ... -->¤Ë¤è¤Ã¤Æ¥³¥á¥ó¥È¤È¤·¤Æɽ¼¨¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£

XHTML¥Õ¥¡¥¤¥ëÃæ¤Ë¤Þ¤È¤á¤Æµ­½Ò¤¹¤ëÊýË¡

<script type="text/javascript">
//<![CDATA[
	¥³¥³¤Ë¥³¡¼¥É¤òµ­½Ò¤·¤Þ¤¹
//]]>
</script>
<noscript>¤´»ÈÍѤδĶ­¤Ç¤ÏJavaScript¤¬Æ°ºî¤·¤Þ¤»¤ó¡£
¤³¤Î¥Ú¡¼¥¸¤ÏJavaScript¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤Î¤Ç¡¢°ìÉôµ¡Ç½¤ò¤´ÍøÍѤ¤¤¿¤À¤±¤Þ¤»¤ó¡£</noscript>

XHTML¤Ç¤Ï<!-- -->¤ò»ÈÍѤ¹¤ë¤ÈËÜÅö¤Ë¥³¥á¥ó¥È¤È¤Ê¤ê¥¹¥¯¥ê¥×¥È¤¬¼Â¹Ô¤µ¤ì¤Ê¤¯¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢<![CDATA[ ... ]]>¤Ë¤è¤Ã¤Æ¥¹¥¯¥ê¥×¥È¤ò°Ï¤¤¤Þ¤¹¡£¥¹¥¯¥ê¥×¥È¤¬Íø¤¯¥Ö¥é¥¦¥¶¤Ç¤Ï//¤Ç¤³¤Î°Ï¤¤¼«¿È¤ò̵¸ú¤È¤·¤Þ¤¹¡£

¥¿¥°¤Î¥¤¥Ù¥ó¥È¥Ï¥ó¥É¥é°À­¤ÇľÀܵ­½Ò¤¹¤ëÊýË¡

<iframe src="http://mainichi.jp/" width="1024" height="768" scrolling="auto" frameborder="1" onLoad="alert('loaded')">
</iframe>

a¥¿¥°¤Îhref¤ËľÀܵ­½Ò¤¹¤ëÊýË¡

<a href="JavaScript:window.alert('Hello, world!');">¥À¥¤¥¢¥í¥°¤òɽ¼¨</a>

¥ê¥ó¥¯