<!DOCTYPE ?HTML><html>? ? <head>? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />? ? ? ? <title>函數(shù)</title>? ? ? ? <script type="text/javascript">? ? ? ? ?function openl()//創(chuàng)建數(shù)openl()? ? ? ? ? {? ? ? ? ? var a=document.getElementById("aaa").value;? ? ? ? ? a=a*1; ? ? ? ? ? ? ? ? ? ?//創(chuàng)建變量a,賦值a等于id為“aaa”的文本框中的值,并使a轉(zhuǎn)為數(shù)字型? ? ? ? ? var b=document.getElementById("bbb").value;? ? ? ? ? b=b*1; ? ? ? ? ? ? ? ? ?//創(chuàng)建變量b,賦值a等于id為“bbb”的文本框中的值,并使b轉(zhuǎn)為數(shù)字型? ? ? ? ? var c=document.getElementById("ccc").value; ? ? ? ? ? ? ? ? ?//創(chuàng)建向量c,并賦值c等于id為“ddd”的多選框中的值? ? ? ? ? var d="";//創(chuàng)建變量d? ? ? ? ?? ? ? ? ? ? ? if(ccc==="+")? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ?d=a+b? ? ? ? ? ? ? }? ? ? ? ? ? ? else if(c==="-")? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? d=a-b? ? ? ? ? ? ? }? ? ? ? ? ? ? else if(c==="*")? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? d=a*b? ? ? ? ? ? ? }? ? ? ? ? ? ? else? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? d=a/b? ? ? ? ? ? ? }? ? ? ? ? document.getElementById("ddd").value=d; ? ? ? ? ? ? ?//使id為“ddd”的文本框輸出d? ? ? ? ? }? ? ? ? </script> ? ? ?? ? </head>? ??? ? <body>? ? ? ? <input type="text" id="aaa"/>? ? ? ? <select id="ccc">? ? ? ? ? ? <option value="+">+</option>? ? ? ? ? ? <option value="-">-</option>? ? ? ? ? ? <option value="*">*</option>? ? ? ? ? ? <option value="/">/</option>? ? ? ? </select>? ? ? ? <input type="text" id="bbb"/>? ? ? ? <button onlick="openl()">=</button>? ? ? ? <input type="text" id="ddd"/>? ? ? ??? ? </body></html>
請(qǐng)問這段代碼出現(xiàn)什么問題?為什么無法運(yùn)行?
我要沖錢
2016-11-12 07:33:17