<?xml version="1.0" encoding="Shift_JIS"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:HTA="urn:schemas-microsoft-com:hta" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" /> <meta http-equiv="Content-Script-Type" content="text/VBScript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <title>さんぷる</title> <style> body { overflow: auto; background-color: ThreeDFace; color: WindowText; margin: 12px; padding: 0px; font: 100% "MS UI Gothic", Serif; border-style: None; text-align: left; cursor: default; } </style> <HTA:APPLICATION APPLICATIONNAME="てきとー" BORDER="dialog" BORDERSTYLE="normal" CAPTION="yes" CONTEXTMENU="no" ID="HTA" INNERBORDER="no" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" NAVIGABLE="no" SCROLL="no" SCROLLFLAT="yes" SELECTION="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" VERSION="1.0" WINDOWSTATE="normal" /> <script type="text/VBScript"> '<![CDTA[ Option Explicit Sub Initialize() window.resizeTo 260, 400 Set cmbBlood.onchange = GetRef("Foo") Set lstHoroscope.onchange = GetRef("Foo") Call Foo() End Sub Sub Foo() 'MsgBox "変更されたね?", vbInformation If cmbBlood.selectedIndex = -1 Then valBloodSimple.innerText = "" txtBloodSimple.innerText = "(未選択)" Else valBloodSimple.innerText = cmbBlood.value txtBloodSimple.innerText = cmbBlood.options(cmbBlood.selectedIndex).text End If If lstHoroscope.selectedIndex = -1 Then valContentsMulti.innerText = "" txtContentsMulti.innerText = "(未選択)" Else Dim s1, s2 s1 = "" s2 = "" Dim opt For Each opt In lstHoroscope.options If opt.selected Then s1 = s1 & "," & opt.value s2 = s2 & "," & opt.text End If Next valContentsMulti.innerText = Mid(s1, 2) txtContentsMulti.innerText = Mid(s2, 2) End If End Sub Set window.onload = GetRef("Initialize") ']]> </script> </head> <body> <p>血液型: <select id="cmbBlood"> <option value="A">A型</option> <option value="B" selected="selected">B型</option> <option value="O">O型</option> <option value="AB">AB型</option> </select></p> <p>星座:<br /> <select name="lstHoroscope" size="8" multiple="multiple"> <option value="Aries">おひつじ座</option> <option value="Taurus">おうし座</option> <option value="Gemini">ふたご座</option> <option value="Cancer">かに座</option> <option value="Leo">しし座</option> <option value="Virgo" selected="selected">おとめ座</option> <option value="Libra" selected="selected">てんびん座</option> <option value="Scorpio">さそり座</option> <option value="Saggitarius">いて座</option> <option value="Capricorn">やぎ座</option> <option value="Aquarius">みずがめ座</option> <option value="Pisces">うお座</option> </select></p> <hr/> <div id="valBloodSimple" style="color:red"></div> <div id="txtBloodSimple" style="color:blue"></div> <hr/> <div id="valContentsMulti" style="color:red"></div> <div id="txtContentsMulti" style="color:blue"></div> </body> </html>