Heim  >  Artikel  >  Backend-Entwicklung  >  js有关onclick的有关问题

js有关onclick的有关问题

WBOY
WBOYOriginal
2016-06-13 12:12:35944Durchsuche

js有关onclick的问题










四则运算
计算矩形















请输入x1:
请输入x2:
请选择计算类型:
















请输入长:
请输入宽:








<script><br /> function selType(s){<br /> window.alert(s);<br /> if(s=='jisuan'){<br /> <br /> table1.style.display="block";<br /> table2.style.display="none“;<br /> }else if(s=='area'){<br /> <br /> table1.style.display="none";<br /> table2.style.display="block";<br /> }<br /> }<br /> <br /> </script>





在<script></script>中if(s=='jisuan'){

table1.style.display="block";
table2.style.display="none“;
}else if(s=='area'){

table1.style.display="none";
table2.style.display="block";
}
这一段去掉onclick就响应window.alert()了
但是加上后不但 if 执行不了,window.alert也不响应了
------解决思路----------------------
楼主好像selType方法里一个引号打错了...
<br />//table2.style.display="none“;<br />table2.style.display="none";<br />
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn