我想把打字完以后的正确字数结果保存到ACCESS数据库中,可是就是保存不进入去,是怎么弄的啊,麻烦高手帮我弄一下.程序如下:
<input id=inpu_onoff type=button value='开始' onclick='f_start()'>
<br>样本文章:<input id=inpu_text size=83 style='font-size:12px'>
<br>
<br>
对照录入:<input id=inpu_type readonly size=83 style='font-size:12px'>
<br>
<br>
错误提示:<input id=inpu_wrong readonly size=83 style='font-size:12px'>
<br>
<input name=radi_resource type=radio onclick=f_set_res() checked>
文章
<input name=radi_resource type=hidden onclick=f_set_res()>
<input name=radi_resource type=hidden onclick=f_set_res()>
<input name=radi_resource type=hidden onclick=f_set_res()>
<input name=radi_resource type=hidden onclick=f_set_res()>
<input name=radi_resource type=hidden onclick=f_set_res()>
<input id=chec_ifrandom type=hidden>
<input id=text_sample type=hidden>
<table width=474>
<tr>
<td width=29%> </td>
<td width=71%>
<input id=inpu_speed readonly type=hidden>
<input id=inpu_right readonly type=hidden>
<input id=inpu_disptime readonly type=hidden>
<input id=inpu_righttype readonly>
正确字数<br>
<input id=inpu_ttltype readonly>
总字数
</td>
</tr>
</table>
<input id=inpu_curtime style='display:none'>
<textarea id=text_article style='display:none'>
中国新时期人民警察的精神如下:忠诚可靠,秉公执法,英勇善战,纪律严明,无私奉献。</textarea>
<script>
/////////////////START USER JS FUNCTION//////////////////
f_start() ///auto start, when onload run the main
function f_start() //reset all, set text, get ready to go
{
inpu_text.value=''
inpu_type.value=''
inpu_wrong.value=''
inpu_curtime.value=0
inpu_speed.value='0.00'
inpu_right.value='0.00%'
inpu_disptime.value='0:0:0.0'
inpu_righttype.value=0
inpu_ttltype.value=0
inpu_onoff.outerHTML="<center><input id=inpu_onoff type=hidden value='3' onclick='f_stop()' disabled></center>"
f_set_res()
f_readygo()
}
function f_stop() //when end typing stop time
{
clearTimeout(tt_timeout)
inpu_type.readOnly=true
inpu_onoff.outerHTML="<input id=inpu_onoff type=hidden value='开始' onclick='f_start()'>"
inpu_onoff.focus()
f_result()
}
function f_readygo() //2~~~1...GO!!! when ready start time & input
{
tt_timeout=setTimeout("inpu_onoff.value='2'",1000)
tt_timeout=setTimeout("inpu_onoff.value='1'",2000)
tt_timeout=setTimeout("inpu_onoff.value='开始'",3000)
tt_timeout=setTimeout('f_settext()',3000)
tt_timeout=setTimeout('inpu_type.readOnly=false;inpu_type.focus()',4000)
tt_timeout=setTimeout("inpu_onoff.value='Stop';inpu_onoff.disabled=false",4000)
tt_timeout=setTimeout('f_refresh()',4000)
}
function f_settext() //random or not
{
if(chec_ifrandom.checked==1)
{
f_randomtext()
}
else
{
f_ordertext()
}
}
function f_ordertext() //show 50 order words in input box
{
temp_array=text_sample.value.split('\r\n').join('')
temp_random=Math.round(Math.random()*(temp_array.length-50))
inpu_text.value=temp_array.substr(temp_random,50)
}
function f_randomtext() //show 50 random chars in input box
{
temp_array=text_sample.value.split('\r\n').join('')
temp_random=temp_array
inpu_text.value=''
for(i=0;i<50;i++)
{
char_rand=temp_random.charAt(Math.round(Math.random()*(temp_random.length-1)))
inpu_text.value+=char_rand
}
}
function f_refresh()
{
f_show_time()
f_show_record()
tt_timeout=setTimeout('f_refresh()',100) //refresh time per 0.1seconds
}
function f_show_time()
{
inpu_curtime.value++ //set time into input box
temp=new Array
temp[0]=parseInt(inpu_curtime.value) //get real millions
temp[1]=parseInt(inpu_curtime.value/10) //get real seconds
temp[2]=parseInt(inpu_curtime.value/10/60) //get real minutes
temp[3]=parseInt(inpu_curtime.value/10/60/60) //get real hours
temp[0]=temp[0]%10 //only millions
temp[1]=temp[1]%60 //only seconds
temp[2]=temp[2]%60 //only minutes
temp[3]=temp[3] //only hours
inpu_disptime.value=temp[3]+':'+temp[2]+':'+temp[1]+'.'+temp[0] //put time into input box
}
function f_show_record()
{
inpu_ttltype.value=inpu_type.value.length
inpu_speed.value=(inpu_ttltype.value/(inpu_curtime.value/10)*60).toFixed(2)
//Input Right Begin
inpu_righttype.value=inpu_ttltype.value
inpu_wrong.value=''
for(i=0;i<inpu_ttltype.value;i++)
{
if(inpu_text.value.charAt(i)!=inpu_type.value.charAt(i)) //diff text & type
{
inpu_righttype.value-- //if diff
inpu_wrong.value+='?' //type wrong alert
}
else //same (type right)
{
inpu_wrong.value+=' ' //show type right
}
}
//Input Right End
//Right Rate Begin
if(inpu_ttltype.value==0)
inpu_right.value='0.00%'
else
inpu_right.value=(inpu_righttype.value/inpu_ttltype.value*100).toFixed(2)+'%'
//Right Rate End
}
function f_set_res() //show radio
{
if(radi_resource[0].checked==true)
{
text_sample.value=text_article.value
}
else if(radi_resource[1].checked==true)
{
text_sample.value='中共中央政治局常委 '
}
else if(radi_resource[2].checked==true)
{
text_sample.value='\',.pyfgcrlaoeuidhtns;qjkxbmwvz'
}
else if(radi_resource[3].checked==true)
{
text_sample.value='abcdefghijklmnopqrstuvwxyz'
}
else if(radi_resource[4].checked==true)
{
text_sample.value='1234567890'
}
else if(radi_resource[5].checked==true)
{
text_sample.value=''
}
}
/////////////////END USER JS FUNCTION//////////////////
/////////////////START SYSTEM JS FUNCTION//////////////////
function document.onkeydown()
{
if(event.keyCode==13&&inpu_onoff.value=='Stop')
{
f_stop()
return false
}
}
</script>
[此贴子已经被作者于2007-8-1 13:11:04编辑过]