18 ƒXƒNƒŠƒvƒg

–ÚŽŸ

  1. ƒXƒNƒŠƒvƒg‚ÌŠTà
  2. ƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚·‚郆[ƒUƒG[ƒWƒFƒ“ƒgŒü‚¯‚Ì•¶‘ÝŒv
    1. SCRIPT—v‘f
    2. ƒXƒNƒŠƒvƒgŒ¾Œê‚ÌŽw’è
    3. ‘gž‚݃Cƒxƒ“ƒg
    4. •¶‘‚Ì“®“I•ÏX
  3. ƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒgŒü‚¯‚Ì•¶‘ÝŒv
    1. NOSCRIPT—v‘f
    2. ƒXƒNƒŠƒvƒgƒf[ƒ^‚ðƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚©‚ç‰B‚·

18.1 ƒXƒNƒŠƒvƒg‚ÌŠTà

ƒNƒ‰ƒCƒAƒ“ƒg‘¤ƒXƒNƒŠƒvƒg‚Ƃ́AHTML•¶‘‚ƘAŒg‚·‚é‚©A‚Ü‚½‚Í•¶‘‚É’¼Ú‘gž‚Ü‚ê‚é‚悤‚ȃvƒƒOƒ‰ƒ€‚Ì‚±‚Æ‚Å‚ ‚éB‚±‚̃vƒƒOƒ‰ƒ€‚́A•¶‘‚ªƒNƒ‰ƒCƒAƒ“ƒgŠÂ‹«‚ɓǂݍž‚Ü‚ê‚éÛ‚ÉŽÀs‚³‚ꂽ‚èAƒŠƒ“ƒN‚ªƒAƒNƒeƒBƒu‚É‚È‚Á‚½Û‚È‚Ç‚ÉŽÀs‚³‚ꂽ‚è‚·‚éBHTML‚ªƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚·‚é•û–@‚́AƒXƒNƒŠƒvƒgŒ¾Œê‚ÌŽí•Ê‚©‚ç‚Í“Æ—§‚Å‚ ‚éB

ƒXƒNƒŠƒvƒg‚ð—p‚¢‚é‚ƁA’˜ŽÒ‚́AHTML•¶‘‚ð‚“x‚É“®“I‚É‚µ‚½‚è‘Θb“I‚É‚µ‚½‚è‚·‚é•ûŒü‚ÅŠg’£‚Å‚«‚éB—á‚ð‹“‚°‚悤B

’˜ŽÒ‚ªHTML•¶‘‚É“Y•t‚Å‚«‚éƒXƒNƒŠƒvƒg‚ɂ́A2‚‚̎í—Þ‚ª‚ ‚éB

’ˆÓB –{Žd—l‚ɂ́AƒXƒNƒŠƒvƒg‚ÉŠÖ˜A‚µ‚āA ƒXƒNƒŠƒvƒgƒ}ƒNƒ‚ɂ‚¢‚Ă̏ڍ׏î•ñ‚ª‚ ‚éB

18.2 ƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚·‚郆[ƒUƒG[ƒWƒFƒ“ƒgŒü‚¯‚Ì•¶‘ÝŒv

ˆÈ‰º‚ÌŠeß‚ł́AƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚·‚郆[ƒUƒG[ƒWƒFƒ“ƒg‚ÉŠÖŒW‚·‚é“à—e‚ðà–¾‚·‚éB

18.2.1 SCRIPT—v‘f

<!ELEMENT SCRIPT - - %Script;          -- script statements -->
<!ATTLIST SCRIPT
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #REQUIRED -- content type of script language --
  src         %URI;          #IMPLIED  -- URI for an external script --
  defer       (defer)        #IMPLIED  -- UA may defer execution of script --
  >

ŠJŽnƒ^ƒO: •K{AI—¹ƒ^ƒO: •K{

‘®«’è‹`

src = uri [CT]
‚±‚Ì‘®«‚́AŠO•”ƒXƒNƒŠƒvƒg‚̏ŠÝ‚ðŽw’è‚·‚éB
type = content-type [CI]
ƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðã‘‚«‚µA“–ŠY—v‘f“à—e‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðŽw’è‚·‚éBƒXƒNƒŠƒvƒgŒ¾Œê‚́Autext/javascriptv‚̂悤‚ÉMIMEƒ^ƒCƒv‚ÅŽw’è‚·‚éB’˜ŽÒ‚Í“–ŠY‘®«’l‚ð•K‚¸‹Lq‚µ‚È‚¯‚ê‚΂Ȃç‚È‚¢B‚±‚Ì‘®«‚̃fƒtƒHƒ‹ƒg’l‚Í‘¶Ý‚µ‚È‚¢B
language = cdata [CI]
„§‚µ‚È‚¢B ‚±‚Ì‘®«‚́A“–ŠY—v‘f“à—e‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðŽw’è‚·‚éB‚±‚Ì’l‚ÍŒ¾Œê‚ÌŽ¯•ÊŽq‚Å‚Í‚ ‚邪AŽ¯•ÊŽq‚ªyƒCƒ“ƒ^[ƒlƒbƒg‚́z•W€‚Å‚Í‚È‚¢‚̂ŁA‚±‚Ì‘®«‚͐„§‚µ‚È‚¢‚±‚Æ‚Æ‚È‚èAtype‚ðÌ—p‚·‚éB
defer [CI]
‚±‚̘_—Œ^‘®«‚ðÝ’肵‚½ê‡Aƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚ɑ΂µA“–ŠYƒXƒNƒŠƒvƒg‚ª•¶‘‚Ì–{•¶‚ð­‚µ‚à¶¬‚µ‚È‚¢‚±‚Æ‚ªŽ¦´‚³‚ê‚éB—Ⴆ‚΁AJavaScript‚Å‚¢‚¤udocument.writev‚ªŠÜ‚Ü‚ê‚È‚¢A‚ȂǁB]‚Á‚ㆁ[ƒUƒG[ƒWƒFƒ“ƒg‚́AyƒXƒNƒŠƒvƒg‚ÌŽÀs‚ð‘Ò‚½‚¸‚Ɂzƒp[ƒX‚ƃŒƒ“ƒ_ƒŠƒ“ƒO‚ðŒp‘±‚Å‚«‚éB

•Ê“r’è‹`‚ª‚ ‚é‘®«

SCRIPT—v‘f‚́AHTML•¶‘‚ɃXƒNƒŠƒvƒg‚ð‘g‚ݍž‚Þ‚à‚̂ŁA HEAD—v‘f‚ ‚é‚¢‚Í BODY—v‘f‚ɁA‰½‰ñoŒ»‚µ‚Ä‚à‚æ‚¢B

ƒXƒNƒŠƒvƒg‚́A‚±‚Ì SCRIPT—v‘f‚Ì“à—e‚©A‚Ü‚½‚ÍŠO•”ƒtƒ@ƒCƒ‹‚Å’è‹`‚³‚ê‚éB src‘®«‚̐ݒ肪‚È‚¢ê‡Aƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚Í“–ŠY—v‘f‚Ì“à—e‚ðƒXƒNƒŠƒvƒg‚Å‚ ‚é‚ƉðŽß‚µ‚È‚¯‚ê‚΂Ȃç‚È‚¢B src‘®«‚Ì’l‚ªURI‚¾‚Á‚½ê‡Aƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚Í“–ŠY—v‘f“à—e‚𖳎‹‚µA‚±‚ÌURI‚©‚çƒXƒNƒŠƒvƒg‚ðŽæ“¾‚·‚é•K—v‚ª‚ ‚éB charset‘®«‚ÅŽw’肳‚ê‚Ä‚¢‚镶Žš•„†‰»•û–@‚Ísrc‘®«‚ªŽ¦‚·ƒXƒNƒŠƒvƒg‚Ì•„†‰»•û–@‚ðŽ¦‚µ‚Ä‚¢‚āA“–ŠY SCRIPT—v‘f‚Æ‚Í–³ŠÖŒW‚Å‚ ‚邱‚ƂɁA’ˆÓ‚³‚ꂽ‚¢B

ƒXƒNƒŠƒvƒg‚̓XƒNƒŠƒvƒgƒGƒ“ƒWƒ“‚É‚æ‚Á‚Ä•]‰¿‚³‚ê‚éBƒXƒNƒŠƒvƒgƒGƒ“ƒWƒ“‚̓†[ƒUƒG[ƒWƒFƒ“ƒg‚É‚Æ‚Á‚ÄŠù’m‚Å‚È‚¯‚ê‚΂Ȃç‚È‚¢B

ƒXƒNƒŠƒvƒgƒf[ƒ^‚̃Vƒ“ƒ^ƒNƒX‚ÍŠeƒXƒNƒŠƒvƒgŒ¾Œê‚Ɉˑ¶‚·‚éB

18.2.2 ƒXƒNƒŠƒvƒgŒ¾Œê‚ÌŽw’è

HTML‚Í“Á’èƒXƒNƒŠƒvƒgŒ¾Œê‚Ɉˑ¶‚µ‚È‚¢‚½‚߁A’˜ŽÒ‚̓†[ƒUƒG[ƒWƒFƒ“ƒg‚ɑ΂µAŠeƒXƒNƒŠƒvƒg‚ÌŒ¾Œê‚𖾎¦‚µ‚È‚¯‚ê‚΂Ȃç‚È‚¢BƒXƒNƒŠƒvƒgŒ¾Œê‚́AƒfƒtƒHƒ‹ƒgéŒ¾‚ƋǏŠéŒ¾‚Ì‘o•û‚Å–¾Ž¦‚·‚邱‚Æ‚ª‚Å‚«‚éB

ƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê  

’˜ŽÒ‚́A•¶‘’†‚Ì‚·‚ׂẴXƒNƒŠƒvƒg‚̃fƒtƒHƒ‹ƒg‚Å‚ ‚éƒXƒNƒŠƒvƒgŒ¾Œê‚ðA HEAD—v‘f‚Ì METAéŒ¾‚ŁAŽŸ‚̂悤‚ÉŽw’肵‚È‚¯‚ê‚΂Ȃç‚È‚¢B

<META http-equiv="Content-Script-Type" content="type">

‚±‚Ìtype‚́AƒXƒNƒŠƒvƒgŒ¾Œê‚ðŽ¦‚·MIMEƒ^ƒCƒv‚ŁA—Ⴆ‚΁Autext/tclvAutext/javascriptvAutext/vbscriptv‚Å‚ ‚éB

METAéŒ¾‚ª‘¶Ý‚µ‚È‚¢ê‡AƒfƒtƒHƒ‹ƒg‚́uContent-Script-TypevHTTPƒwƒbƒ_‚ÅŽw’è‚Å‚«‚éB

    Content-Script-Type: type

‚±‚Ìtype‚àAƒXƒNƒŠƒvƒgŒ¾Œê‚ðŽ¦‚·MIMEƒ^ƒCƒv‚Å‚ ‚éB

ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚́AŽŸ‚Ì—Dæ‡ˆÊ‚ɏ]‚Á‚ăfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðŒˆ’è‚·‚é•K—v‚ª‚ ‚éB

  1. Content-Script-Type‚ðŽw’è‚·‚éMETAéŒ¾‚ª‚ ‚éê‡A•¶Žš—ñ’†‚ōŌã‚ÉŒ»‚ê‚ééŒ¾‚Ì“à—e‚ðƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ÉŒˆ’è‚·‚éB
  2. ‚»‚¤‚µ‚½METAéŒ¾‚ª‚È‚­AContent-Script-Type‚ðŽw’è‚·‚éHTTPƒwƒbƒ_‚ª‚ ‚éê‡A•¶Žš—ñ’†‚ōŌã‚ÉŒ»‚ê‚éƒwƒbƒ_‚Ì“à—e‚ðƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ÉŒˆ’è‚·‚éB

ƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðŽw’肵‚Ä‚¢‚È‚¢•¶‘‚Å ‘gž‚݃Cƒxƒ“ƒgƒXƒNƒŠƒvƒg‚ªŽw’肳‚ꂽ—v‘f‚ðŠÜ‚Þ‚à‚̂́A•s³‚Å‚ ‚éBƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚Í‚±‚ê‚ð‰ðŽß‚µ‚悤‚ÆŽŽ‚Ý‚Ä‚à‚æ‚¢‚ªA‰ðŽß‚ðŽŽ‚Ý‚é‚悤—v‹‚³‚ê‚é‚킯‚Å‚Í‚È‚¢B ƒI[ƒTƒŠƒ“ƒOƒc[ƒ‹‚́A’˜ŽÒ‚ª•s³‚È•¶‘‚ðì‚ç‚È‚¢‚Å‚·‚ނ悤AƒfƒtƒHƒ‹ƒgƒXƒNƒŠƒvƒgŒ¾Œê‚̏î•ñ‚𐶐¬‚·‚é•K—v‚ª‚ ‚éB

ƒXƒNƒŠƒvƒgŒ¾Œê‚̋ǏŠéŒ¾ 

•¶‘’†‚Ì‚Ç‚Ì SCRIPT—v‘fƒCƒ“ƒXƒ^ƒ“ƒX‚àAtype‘®«‚ªŽw’肳‚ê‚Ä‚¢‚È‚¯‚ê‚΂Ȃç‚È‚¢B‚ ‚éSCRIPT—v‘f‚Ìtype‘®«’l‚́A“–ŠY—v‘f‚̃fƒtƒHƒ‹ƒgƒXƒNƒŠƒvƒgŒ¾Œê‚ðã‘‚«‚·‚éB

ŽŸ‚Ì—á‚́AƒfƒtƒHƒ‹ƒg‚̃XƒNƒŠƒvƒgŒ¾Œê‚ðutext/tclv‚Ɛ錾‚µ‚Ä‚¢‚éBƒwƒbƒ_‚É‚ÍSCRIPT—v‘f‚ª1‚‚ ‚èA‚±‚ê‚ÍŠO•”ƒtƒ@ƒCƒ‹‚́Atext/vbscript‚Å‚ ‚éƒXƒNƒŠƒvƒg‚ð—p‚¢‚éB–{•¶‚É‚ ‚éSCRIPT—v‘f‚Ì“à—e‚́Atext/javascript‚Å‹L‚³‚ê‚Ä‚¢‚éB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>ƒXƒNƒŠƒvƒg‚ª‚ ‚镶‘</TITLE>
<META http-equiv="Content-Script-Type" content="text/tcl">
<SCRIPT type="text/vbscript" src="http://someplace.com/progs/vbcalc">
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT type="text/javascript">
cJavaScript‚̃XƒNƒŠƒvƒgc
</SCRIPT>
</BODY>
</HTML>

ƒXƒNƒŠƒvƒg‚©‚çHTML‚Ì—v‘f‚ðŽQÆ‚·‚é 

ŠeƒXƒNƒŠƒvƒgŒ¾Œê‚ɂ́AƒXƒNƒŠƒvƒg“à‚©‚çHTML•¶‘ƒIƒuƒWƒFƒNƒg‚ðŽQÆ‚·‚邽‚ß‚Ì‹K–ñ‚ª‘¶Ý‚·‚éB–{Žd—l‚́AHTML•¶‘ƒIƒuƒWƒFƒNƒg‚ðŽQÆ‚·‚邽‚ß‚Ì•W€‹@\‚ð’è‹`‚·‚é‚à‚Ì‚Å‚Í‚È‚¢B

‚µ‚©‚µ‚È‚ª‚çAƒXƒNƒŠƒvƒg‚©‚ç—v‘f‚Ö‚ÌŽQÆ‚́A—v‘f–¼‚ɏ]‚í‚˂΂Ȃç‚È‚¢BƒXƒNƒŠƒvƒgƒGƒ“ƒWƒ“‚́A—v‘f‚ðŽ¯•Ê‚·‚éÛ‚ÉŽŸ‚Ì—DæŠî€‚ɏ]‚¤•K—v‚ª‚ ‚éB‚Ü‚¸Aname‘®«‚Æ id‘®«‚Ì‘o•û‚ªÝ’肳‚ê‚Ä‚¢‚éê‡‚Íname‘®«‚ª—Dæ‚·‚éBŽŸ‚ɁA‚Ç‚¿‚ç‚©ˆê•û‚̏ꍇ‚́A‚ ‚é•û‚ð—p‚¢‚éB

18.2.3 ‘gž‚݃Cƒxƒ“ƒg

’ˆÓB HTML•¶‘‚Ì’˜ŽÒ‚ւ̏•Œ¾B‘gž‚݃Cƒxƒ“ƒg‚̗̈æ‚ł́A—Ⴆ‚΃XƒNƒŠƒvƒg‚ƃCƒxƒ“ƒg‚Æ‚ÌŒ‹‡•û–@‚ȂǁA•p”ɂɕύX‚ª‚ ‚蓾‚éB‚±‚̗̈æ‚ÌŒ¤‹†‚́AW3C‚Ì•¶‘ƒIƒuƒWƒFƒNƒgƒ‚ƒfƒ‹ì‹Æ”ǂ̃ƒ“ƒo[‚ªs‚È‚Á‚Ä‚¢‚éB‚æ‚èÚ‚µ‚¢î•ñ‚ÍW3C‚ÌWebƒTƒCƒg http://www.w3.org/ ‚Å“¾‚ç‚ê‚éB

‘®«’è‹`

onload = script [CT]
onloadƒCƒxƒ“ƒg‚́Aƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚ª1‚‚̃EƒCƒ“ƒhƒE‚̓ǂݍž‚Ý‚ðI—¹‚µ‚½Žž“_A‚ ‚é‚¢‚Í1‚‚ÌFRAMESET’†‚Ì‚·‚ׂẴtƒŒ[ƒ€‚̓ǂݍž‚Ý‚ðI—¹‚µ‚½Žž“_‚Å”­¶‚·‚éB‚±‚Ì‘®«‚́ABODY—v‘f‚ÆFRAMESET—v‘f‚ÅŽg‚¦‚éB
onunload = script [CT]
onunloadƒCƒxƒ“ƒg‚́Aƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚ª1‚‚̃EƒCƒ“ƒhƒE‚ ‚é‚¢‚̓tƒŒ[ƒ€‚©‚當‘‚ðœ‹Ž‚·‚鎞“_‚Å”­¶‚·‚éB‚±‚Ì‘®«‚́A BODY—v‘f‚ÆFRAMESET—v‘f‚ÅŽg‚¦‚éB
onclick = script [CT]
onclickƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚̃{ƒ^ƒ“‚ª—v‘f‚̏ã‚ŃNƒŠƒbƒN‚³‚ꂽŽž“_‚Å”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
ondblclick = script [CT]
ondblclickƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚̃{ƒ^ƒ“‚ª—v‘f‚̏ã‚Ń_ƒuƒ‹ƒNƒŠƒbƒN‚³‚ꂽŽž“_‚Å”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onmousedown = script [CT]
onmousedownƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚̃{ƒ^ƒ“‚ª—v‘f‚̏ã‚ʼnŸ‚µ‰º‚°‚ç‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onmouseup = script [CT]
onmouseupƒCƒxƒ“ƒg‚́A ƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚̃{ƒ^ƒ“‚ª—v‘f‚̏ã‚Å•ú‚³‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onmouseover = script [CT]
onmouseoverƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚ª—v‘f‚̏ã‚Ɉړ®‚µ‚Ä‚«‚½Û‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onmousemove = script [CT]
onmousemoveƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚ª—v‘f‚̏ã‚ðˆÚ“®‚·‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onmouseout = script [CT]
onmouseoutƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚ª—v‘f‚̏ォ‚ç—£‚ê‚Ä‚¢‚­Û‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onfocus = script [CT]
onfocusƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚©ƒ^ƒuˆÚ“®‚É‚æ‚Á‚Ä—v‘f‚ªƒtƒH[ƒJƒX‚ðŽó‚¯‚½Û‚É”­¶‚·‚éB‚±‚Ì‘®«‚ÍŽŸ‚Ì—v‘f‚ÅŽg‚¦‚éB AAAREAALABELAINPUTA SELECTATEXTAREAABUTTONB
onblur = script [CT]
onblurƒCƒxƒ“ƒg‚́Aƒ|ƒCƒ“ƒeƒBƒ“ƒOƒfƒoƒCƒX‚©ƒ^ƒuˆÚ“®‚É‚æ‚Á‚Ä—v‘f‚ªƒtƒH[ƒJƒX‚ðŽ¸‚Á‚½Û‚É”­¶‚·‚éB‚±‚Ì‘®«‚Íonfocus‘®«‚Æ“¯‚¶—v‘f‚ÅŽg‚¦‚éB
onkeypress = script [CT]
onkeypressƒCƒxƒ“ƒg‚́A—v‘fã‚ʼn½‚©‚ ‚éƒL[‚ª‰Ÿ‚³‚ê‚Ä•ú‚³‚ꂽÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onkeydown = script [CT]
onkeydownƒCƒxƒ“ƒg‚́A—v‘fã‚ʼn½‚©‚ ‚éƒL[‚ª‰Ÿ‚µ‰º‚°‚ç‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onkeyup = script [CT]
onkeyupƒCƒxƒ“ƒg‚́A—v‘fã‚ʼn½‚©‚ ‚éƒL[‚ª‰ð•ú‚³‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚́A‚Ù‚Æ‚ñ‚Ç‚Ì—v‘f‚ÅŽg‚¦‚éB
onsubmit = script [CT]
onsubmitƒCƒxƒ“ƒg‚́AƒtƒH[ƒ€‚ª’ño‚³‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚ÍFORM—v‘f‚Ì‚Ý‚É“K—p‚³‚ê‚éB
onreset = script [CT]
onresetƒCƒxƒ“ƒg‚́AƒtƒH[ƒ€‚ªƒŠƒZƒbƒg‚³‚ê‚éÛ‚É”­¶‚·‚éB‚±‚Ì‘®«‚Í FORM—v‘f‚Ì‚Ý‚É“K—p‚³‚ê‚éB
onselect = script [CT]
onselectƒCƒxƒ“ƒg‚́Aƒ†[ƒU‚ªƒeƒLƒXƒgƒtƒB[ƒ‹ƒh’†‚̃eƒLƒXƒg‚ð‘I‚ñ‚¾Û‚É”­¶‚·‚éB‚±‚Ì‘®«‚ÍINPUT—v‘f‚Æ TEXTAREA—v‘f‚ÅŽg‚¦‚éB
onchange = script [CT]
onchangeƒCƒxƒ“ƒg‚́AƒRƒ“ƒgƒ[ƒ‹‚ª“ü—̓tƒH[ƒJƒX‚ðŽ¸‚Á‚½Û‚ɁAƒtƒH[ƒJƒX‚𓾂½Žž‚Æ”ä‚ׂĒl‚ª•Ï‰»‚µ‚Ä‚¢‚½Žž‚É”­¶‚·‚éB‚±‚Ì‘®«‚́AINPUTASELECTA TEXTAREA—v‘f‚É“K—p‚Å‚«‚éB

ƒ†[ƒU‚ªƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚ƑΘb‚·‚éÛ‚É”­¶‚·‚é•¡”‚̃Cƒxƒ“ƒg‚Æ1‚‚̓®ì‚ðŒ‹‚Ñ‚Â‚¯‚邱‚Æ‚à‰Â”\‚Å‚ ‚éBã‚É—ñ‹“‚µ‚½u‘gž‚݃Cƒxƒ“ƒgv‚Í‚Ç‚ê‚àAƒXƒNƒŠƒvƒg‚ð’l‚ÉŽæ‚éB‚±‚̃XƒNƒŠƒvƒg‚́A“–ŠY—v‘f‚ÉŠÖŒW‚·‚éƒCƒxƒ“ƒg‚ª”­¶‚·‚é“x‚ɏí‚ÉŽÀs‚³‚ê‚éB ƒXƒNƒŠƒvƒgƒf[ƒ^‚̃Vƒ“ƒ^ƒNƒX‚́AŠeƒXƒNƒŠƒvƒgŒ¾Œê‚Ɉˑ¶‚·‚éB

ƒtƒH[ƒ€‚̃Rƒ“ƒgƒ[ƒ‹—v‘f‚Å‚ ‚éAINPUT, SELECTABUTTONA TEXTAREAA•À‚Ñ‚ÉLABEL—v‘f‚́A‚·‚ׂĉ½‚ç‚©‚Ì‘gž‚݃Cƒxƒ“ƒg‚É”½‰ž‚·‚éB‚±‚ê‚ç‚Ì—v‘f‚ªƒtƒH[ƒ€‚ÌŠO•”‚ɏoŒ»‚·‚éê‡A‚±‚ê‚Í•¶‘‚̃Oƒ‰ƒtƒBƒJƒ‹‚ȃ†[ƒUƒCƒ“ƒ^[ƒtƒF[ƒX‚𑝋­‚·‚邽‚ß‚ÉŽg‚í‚ê‚Ä‚¢‚é‚ÆŽv‚í‚ê‚éB

—Ⴆ‚΁AƒAƒNƒeƒBƒu‚É‚È‚Á‚½Û‚ɁAƒtƒH[ƒ€‚ð’ño‚·‚é‚Ì‚Å‚Í‚È‚¢‚ªƒT[ƒo‚ÆŒðM‚ð‚·‚é‚悤‚ȉŸ‚µƒ{ƒ^ƒ“‚𕶏‘‚É‘gž‚Ý‚½‚¢‚ƍl‚¦‚é’˜ŽÒ‚à‚ ‚낤B

‚±‚±‚ŁA‘g‚ݍž‚݃Cƒxƒ“ƒg‚ÉŠî‚­ƒ†[ƒUƒCƒ“ƒ^[ƒtƒF[ƒX‹@”\‚Æ—˜—p‰Â”\‚ȃRƒ“ƒgƒ[ƒ‹‚Ì—á‚ðŠô‚‚©Ž¦‚·B

ŽŸ‚Ì—á‚ł́AuserName‚ւ̃eƒLƒXƒg“ü—Í‚ª—v‹‚³‚ê‚éBƒ†[ƒU‚ª“ü—̓tƒB[ƒ‹ƒh‚𗣂ê‚悤‚Æ‚·‚éÛA onblurƒCƒxƒ“ƒg‚ªJavaScript‚̊֐”‚ðŒÄ‚яo‚µAuserName‚É“KØ‚È’l‚ª“ü—Í‚³‚ê‚Ä‚¢‚é‚©‚Ç‚¤‚©‚ªŒŸ’肳‚ê‚éB

<INPUT NAME="userName" onblur="validUserName(this.value)">

X‚É•Ê‚ÌJavaScript‚Ì—á‚ðŽ¦‚·B

<INPUT NAME="num"
    onchange="if (!checkNum(this.value, 1, 10)) 
        {this.focus();this.select();} else {thanks()}"
    VALUE="0">

¡“x‚̓eƒLƒXƒgƒtƒB[ƒ‹ƒh‚̃Cƒxƒ“ƒgƒnƒ“ƒhƒ‰‚Å‚ ‚éVBScript‚Ì—á‚ðŽ¦‚·B

    <INPUT name="edit1" size="50">    
    <SCRIPT type="text/vbscript">
      Sub edit1_changed()
        If edit1.value = "abc" Then
          button1.enabled = True
        Else
          button1.enabled = False
        End If
      End Sub
    </SCRIPT>

‚±‚ê‚ðTcl‚É‚µ‚½—á‚ðŽ¦‚·B

    <INPUT name="edit1" size="50">
    <SCRIPT type="text/tcl">
      proc edit1_changed {} {
        if {[edit value] == abc} {
          button1 enable 1
        } else {
          button1 enable 0
        }
      }
      edit1 onChange edit1_changed
    </SCRIPT>

‘±‚¢‚āAƒXƒNƒŠƒvƒg‚Ì‹Lq“à—e‚ɃCƒxƒ“ƒg‚ð‘gž‚ñ‚¾JavaScript‚Ì—á‚ðŽ¦‚·B‚Ü‚¸A’Pƒ‚ȃNƒŠƒbƒNƒnƒ“ƒhƒ‰‚Ì—áB

    
<BUTTON type="button" name="mybutton" value="10">
<SCRIPT type="text/javascript">
      function my_onclick() {
         . . .
      }
    document.form.mybutton.onclick = my_onclick
 </SCRIPT>
 </BUTTON>

ŽŸ‚ɁA‚à‚¤­‚µ–Ê”’‚¢ƒEƒCƒ“ƒhƒEƒnƒ“ƒhƒ‰‚Ì—áB

    
<SCRIPT type="text/javascript">
      function my_onload() {
         . . .
      }

      var win = window.open("some/other/URI")
      if (win) win.onload = my_onload
</SCRIPT>

‚±‚ê‚ÍTcl‚Å‚ÍŽŸ‚̂悤‚É‚È‚éB

 <SCRIPT type="text/tcl">
     proc my_onload {} {
       . . .
     }
     set win [window open "some/other/URI"]
     if {$win != ""} {
         $win onload my_onload
     }
 </SCRIPT>

‚±‚±‚ŁA‘gž‚݃Cƒxƒ“ƒgƒnƒ“ƒhƒ‰’†‚́udocument.writev‚ ‚é‚¢‚Í‚±‚ê‚Æ“™‰¿‚È–½—ß•¶‚ªAŒ»Ý‚Ì•¶‘‚ðXV‚·‚é‚Ì‚Å‚Í‚È‚­V‚µ‚¢•¶‘‚ðì¬‚·‚é‚Ì‚Å‚ ‚é“_‚É’ˆÓ‚³‚ꂽ‚¢B

18.2.4 •¶‘‚Ì“®“I•ÏX

•¶‘‚̓ǂݍž‚Ý‚Æ“¯Žž‚ÉŽÀs‚³‚ê‚éƒXƒNƒŠƒvƒg‚́A•¶‘‚Ì“à—e‚ð“®“I‚ɕύX‚Å‚«‚éB‚±‚̕ύX”\—͂́AƒXƒNƒŠƒvƒgŒ¾ŒêŽ©‘̂Ɉˑ¶‚·‚éB—Ⴆ‚΁A•¡”‚̃xƒ“ƒ_[‚ªHTMLƒIƒuƒWƒFƒNƒgƒ‚ƒfƒ‹‚́udocument.writev–½—ß•¶‚ðƒTƒ|[ƒg‚µ‚Ä‚¢‚éB

•¶‘‚Ì“®“I•ÏX‚́AŽŸ‚̂悤‚Ƀ‚ƒfƒ‹‰»‚Å‚«‚éB

  1. ‚·‚×‚Ä‚Ì SCRIPT—v‘f‚́A•¶‘‚ª“ǂݍž‚Ü‚ê‚éÛ‚̏‡”Ô‚Å•]‰¿‚³‚ê‚éB
  2. —^‚¦‚ç‚ꂽSCRIPT—v‘f‚É‚ ‚éSGML CDATA‚ðŒ`¬‚·‚éA‚·‚ׂẴXƒNƒŠƒvƒg\¬‘f‚ª•]‰¿‚³‚ê‚éB ‚»‚ÌŒ‹‡¶¬ƒeƒLƒXƒg‚́A•¶‘’†‚Ì“–ŠYSCRIPT—v‘f‚̈ʒu‚É‘}“ü‚³‚ê‚éB
  3. ¶¬‚³‚ꂽCDATA‚́AÄ•]‰¿‚³‚ê‚éB

HTML•¶‘‚́A‚Ç‚ÌSCRIPT—v‘f‚̏ˆ—‘O‚àˆ—Œã‚àAHTML DTD‚É“K‡‚·‚é‚悤§–ñ‚³‚ê‚éB

ŽŸ‚Ì—á‚́AƒXƒNƒŠƒvƒg‚ª•¶‘‚ð‚ǂ̂悤‚É“®“I‚ɕύX‚·‚é‚©‚ðŽ¦‚·B

 <TITLE>ƒeƒXƒg•¶‘</TITLE>
 <SCRIPT type="text/javascript">
     document.write("<p><b>Hello World!<\/b>")
 </SCRIPT>

ã‚̃XƒNƒŠƒvƒg‚́AŽŸ‚ÌHTMLƒ}[ƒN•t‚¯‚Æ“¯“™‚ÌŒø‰Ê‚ðŽ‚Á‚Ä‚¢‚éB

 <TITLE>ƒeƒXƒg•¶‘</TITLE>
 <P><B>Hello World!</B>

18.3 ƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒgŒü‚¯‚Ì•¶‘ÝŒv

‚±‚̐߂ł́A’˜ŽÒ‚ªAƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚Å‹@”\‚·‚镶‘‚ð‚ǂ̂悤‚ɍì‚ê‚΂¢‚¢‚©‚ðà–¾‚·‚éB

18.3.1 NOSCRIPT—v‘f

<!ELEMENT NOSCRIPT - - (%block;)+
  -- alternate content container for non script-based rendering -->
<!ATTLIST NOSCRIPT
  %attrs;                              -- %coreattrs, %i18n, %events --
  >

ŠJŽnƒ^ƒO: •K{AI—¹ƒ^ƒO: •K{

NOSCRIPT—v‘f‚ðŽg‚¤‚ƁA’˜ŽÒ‚́AƒXƒNƒŠƒvƒg‚ªŽÀs‚³‚ê‚È‚¢Û‚Ì‘ã‘Ö“à—e‚ð’ñ‹Ÿ‚Å‚«‚éB ƒXƒNƒŠƒvƒg‚ð”FŽ¯‚·‚郆[ƒUƒG[ƒWƒFƒ“ƒg‚́A NOSCRIPT—v‘f‚Ì“à—e‚ðAŽŸ‚̏ꍇ‚É‚µ‚©ƒŒƒ“ƒ_ƒŠƒ“ƒO‚µ‚Ä‚Í‚¢‚¯‚È‚¢B

ƒNƒ‰ƒCƒAƒ“ƒg‘¤ƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚µ‚Ä‚¢‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚́A‚±‚Ì—v‘f‚Ì“à—e‚ðƒŒƒ“ƒ_ƒŠƒ“ƒO‚µ‚È‚¯‚ê‚΂Ȃç‚È‚¢B

ŽŸ‚Ì—á‚ł́ASCRIPT‚ðŽÀs‚·‚郆[ƒUƒG[ƒWƒFƒ“ƒg‚Í“®“I‚ɐ¶¬‚µ‚½ƒf[ƒ^‚ð‚¢‚­‚‚©•¶‘‚É‘gž‚݁AƒXƒNƒŠƒvƒg‚ðƒTƒ|[ƒg‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚Å‚àAƒ†[ƒU‚̓Šƒ“ƒN‚ð’Ê‚¶‚ăf[ƒ^‚ðŽæ“¾‚Å‚«‚éB

<SCRIPT type="text/tcl">
 cƒf[ƒ^‚ð‘gž‚Þ‚½‚ß‚ÌTclƒXƒNƒŠƒvƒgc
</SCRIPT>
<NOSCRIPT>
 <P><A href="http://someplace.com/data">data.</A>‚ɃAƒNƒZƒX‚³‚ꂽ‚µB
</NOSCRIPT>

18.3.2 ƒXƒNƒŠƒvƒgƒf[ƒ^‚ðƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚©‚ç‰B‚·

SCRIPT—v‘f‚ð”FŽ¯‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚́A—v‘f‚Ì“à—e‚ðƒeƒLƒXƒg‚Æ‚µ‚ăŒƒ“ƒ_ƒŠƒ“ƒO‚µ‚悤‚Æ‚µ‚ª‚¿‚Å‚ ‚éB JavaScriptAVBScriptA•À‚Ñ‚ÉTcl‚ðŠÜ‚Þ‚¢‚­‚‚©‚̃XƒNƒŠƒvƒgƒGƒ“ƒWƒ“‚́AƒXƒNƒŠƒvƒg‚Ì–½—ß•¶‚ðSGMLƒRƒƒ“ƒg‚Ɉ͂¢ž‚Þ‚±‚Æ‚ð‹–—e‚µ‚Ä‚¢‚éB ‚»‚±‚ŁASCRIPT—v‘f‚ð”FŽ¯‚µ‚È‚¢ƒ†[ƒUƒG[ƒWƒFƒ“ƒg‚̓Rƒƒ“ƒg‚𖳎‹‚·‚邪Aƒ}ƒgƒ‚‚ȃXƒNƒŠƒvƒgƒGƒ“ƒWƒ“‚̓Rƒƒ“ƒg’†‚̃XƒNƒŠƒvƒg‚ðŽÀs‚·‚é•K—v‚ª‚ ‚邱‚Æ‚ð—‰ð‚·‚éB

–â‘è‚ð‰ðŒˆ‚·‚é•Ê‚Ì•û–@‚́AƒXƒNƒŠƒvƒg‚ðŠO•”•¶‘‚Æ‚µA src‘®«‚ÅŽQÆ‚·‚邱‚Æ‚Å‚ ‚éB

JavaScript‚ł̃Rƒƒ“ƒg‰»ƒXƒNƒŠƒvƒg
JavaScriptƒGƒ“ƒWƒ“‚́ASCRIPT—v‘f‚ÌŽn‚ß‚É•¶Žš—ñu<!--v‚ª‘¶Ý‚·‚邱‚Æ‚ð‹–—e‚µA‚±‚̏ꍇ“–ŠYs‚Ì––”ö‚Ü‚Å‚Ì•¶Žš‚𖳎‹‚·‚éB JavaScript‚́Au//v‚ð“–ŠYs‚Ì––”ö‚Ü‚Å‘±‚­ƒRƒƒ“ƒg‚ÌŠJŽn‚Å‚ ‚é‚ƉðŽß‚·‚éB‚±‚́u//v‚́AySGMLƒRƒƒ“ƒg‚ð•Â‚¶‚éz•¶Žš—ñu-->v‚ðJavaScriptƒp[ƒT‚©‚ç‰B‚·‚½‚ß‚É•K—v‚Æ‚³‚ê‚éB

<SCRIPT type="text/javascript">
<!--  to hide script contents from old browsers
  function square(i) {
    document.write("The call passed ", i ," to the function.","<BR>")
    return i * i
  }
  document.write("The function returned ",square(5),".")
// end hiding contents from old browsers  -->
</SCRIPT>

VBScript‚ł̃Rƒƒ“ƒg‰»ƒXƒNƒŠƒvƒg
VBScript‚ł́A’Pˆø—p•„‚É‚æ‚Á‚āA“–ŠYs‚ÌŽc‚è‚Ì•”•ª‚ªƒRƒƒ“ƒg‚Æ‚µ‚Ĉµ‚í‚ê‚邱‚Æ‚Æ‚È‚éB‚»‚±‚ŁA’Pˆø—p•„‚ªAVBScript‚Łu-->v‚ð‰B‚·‚½‚ß‚ÉŽg‚í‚ê‚éB

   <SCRIPT type="text/vbscript">
     <!--
       Sub foo()
        ...
       End Sub
     ' -->
    </SCRIPT>

Tcl‚ł̃Rƒƒ“ƒg‰»ƒXƒNƒŠƒvƒg
Tcl‚ł́Au#v‚ª“–ŠYs‚ÌŽc‚è‚Ì•”•ª‚ðƒRƒƒ“ƒg‚Æ‚·‚éB

<SCRIPT type="text/tcl">
<!--  to hide script contents from old browsers
  proc square {i} {
    document write "The call passed $i to the function.<BR>"
    return [expr $i * $i]
  }
  document write "The function returned [square 5]."
# end hiding contents from old browsers  -->
</SCRIPT>

’ˆÓB ƒuƒ‰ƒEƒU‚Ì’†‚ɂ́AÅ‰‚́u>v‚Æ‚¢‚¤•¶Žš‚ŃRƒƒ“ƒg‚ð•Â‚¶‚é‚à‚Ì‚à‚ ‚éB‚±‚¤‚µ‚½ƒuƒ‰ƒEƒU‚©‚çƒXƒNƒŠƒvƒg“à—e‚ð‰B‚·‚½‚߂ɂ́A—Ⴆ‚΁ux > yv‚Å‚Í‚È‚­uy < xv‚Æ‹L‚·‚ȂǁAŠÖŒW‰‰ŽZŽq‚âˆÚ“®‰‰ŽZŽq‚É‚¨‚¢‚Ĕ퉉ŽZŽq‚ðˆÚ€‚·‚é‚Æ‚¢‚Á‚½Žè–@‚âAŠeƒXƒNƒŠƒvƒgŒ¾ŒêŒÅ—L‚Ì•û–@‚Łu>v‚ðƒGƒXƒP[ƒv‚·‚é‚Æ‚¢‚Á‚½Žè–@‚ªŽæ‚蓾‚éB


–óŽÒ‘ã•\: “à“c–¾ (UCHIDA Akira)
email: [email protected]