<form name="ofrm">
小节名<input type="text" name="osec" /><br />
关键词<input type="text" name="okey" /><br />
值<input type="text" name="ovalue" /><br />
<input type="button" name="oIn" value="写入" />
<input type="button" name="oOut" value="读取" />
</form>
<script language="vbscript" type="text/vbscript">
dim strSec,strKey ,strValue
dim oini
//创建INI文件操作对象
set oini=createobject("iniManager.clsIni")
//'写入按钮的单击事件'
sub oIn_onClick()
//读取输入的数据
strSec=document.ofrm.osec.value
strKey=document.ofrm.okey.value
strValue=document.ofrm.ovalue.value
//数据填写不完整
if Len(strsec)=0 or Len(strkey)=0 or Len(strvalue)=0 then
msgbox "数据填写不完整"
else
//使用时请修改FileName的
oini.FileName="E:\MSIT工程\个人专著\VB+SQL\第8章\例8.7\webIni.ini"
oini.section=strsec
oini.key=strkey
oini.WriteItem strvalue
//写入成功
msgbox "ok"
ofrm.okey.value=""
ofrm.ovalue.value=""
ofrm.okey.focus()
end if
end sub
//读取按钮的单击事件
Sub oOut_onClick()
strSec=document.ofrm.osec.value
strKey=document.ofrm.okey.value
if Len(strsec)=0 or Len(strkey)=0 then
msgbox "数据填写不完整"
else
//使用时请修改FileName的
oini.FileName="E:\MSIT工程\个人专著\VB+SQL\第8章\例8.7\webIni.ini"
oini.section=strsec
oini.key=strkey
//读取并给文本框赋值
document.ofrm.ovalue.value=oini.readItem()
end if
end Sub
</script>
评论22
最新资源