<script>
function doresult(){
if(document.form1.num.value==''){
alert('请输入一个数字');
return false;
}else
{
var re=/[^0-9]+/g;
if(re.test(document.form1.num.value)){
alert('请输入一个数字');
return false;
}
}
var thenum=parseInt(document.form1.num.value);
var theresult=(thenum-1)*4+1024*thenum;
document.getElementById('theshow').innerText=theresult.toString();
}
</script>
<form name=form1>
<input name=num onkeyup="this.value=this.value.replace(/[^\\d]*/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]*/g,''))">
<span id=theshow style="border:1px solid green;margin:0 5px"></span>
<button onclick="javascript:doresult()"><font color=red>计算</font></button>
</form>
function doresult(){
if(document.form1.num.value==''){
alert('请输入一个数字');
return false;
}else
{
var re=/[^0-9]+/g;
if(re.test(document.form1.num.value)){
alert('请输入一个数字');
return false;
}
}
var thenum=parseInt(document.form1.num.value);
var theresult=(thenum-1)*4+1024*thenum;
document.getElementById('theshow').innerText=theresult.toString();
}
</script>
<form name=form1>
<input name=num onkeyup="this.value=this.value.replace(/[^\\d]*/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]*/g,''))">
<span id=theshow style="border:1px solid green;margin:0 5px"></span>
<button onclick="javascript:doresult()"><font color=red>计算</font></button>
</form>