<!DOCTYPE?html>
<html>
?<head>
??<title>?事件</title>??
??<script?type="text/javascript">
???window.onload?=??function()?{
??????document.getElementsByTagName('input')[2].onclick?=?
??????function()?{
?????????var?t1?=?document.getElementsByTagName('input')[0].value;
?????????var?t2?=?document.getElementsByTagName('input')[1].value;
?????????if(!isNaN(parseInt(t1))?&&?!isNaN(parseInt(t2)))?{
????????????document.getElementsByTagName('input')[3].value??=??parseInt(t1)?+?parseInt(t2);?????????????
?????????}?else?{
?????????????alert("請?zhí)顚懻_的數(shù)字");
?????????}
??????}
???}
??</script>?
?</head>?
?<body>
???<input?type='text'?id='txt1'?/>?
???<select?id='select'>
<option?value='+'>+</option>
<option?value="-">-</option>
<option?value="*">*</option>
<option?value="/">/</option>
???</select>
???<input?type='text'?id='txt2'?/>?
???<input?type='button'?value='?=?'?/>?<!--通過?=?按鈕來調(diào)用創(chuàng)建的函數(shù),得到結(jié)果-->?
???<input?type='text'?id='fruit'?/>???
?</body>
</html>
2015-08-14
不裝逼還能好好做朋友