求教javascript高难问题(至少对我而言是高难....) post2.asp<%@language="javascript"%><%username=String(Request.form("username"))Session("username")=username%> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请高手指点把javascript数组数据保存在application的方法在vbscript中可以直接把数组保存到Application中这样可以在其他asp页面里也能共享数组中的数据 vbs.asp<%@language=vbscript%><% dim myarray(10) for i=1 to 10 myarray(i)=i next application("array")=myarray '可以直接把数组保存至application对象 otherarray=application("array") for i=1 to 10 otherarray(i)=i response.write " "&otherarray(i) next '现在就可以共享数组中的数据了%>网页输出:1 2 3 4 5 6 7 8 9 10而在javascript中直接把数组放到application中是无效的 js.asp<%@language=javascript%><% myarray=new Array(10) for(i=0;i<=10;i++){ myarray[i]=i } //--------------------------------------------------------- //Application("array")=myarray.valueOf() //试图把数组直接保存至applicatipn但是产生一个错误 //Application 对象, ASP 0197 (0x80004005) //不能将具有单元模型特点的对象添加到应用程序的固有对象中 //--------------------------------------------------------- Application("array")=myarray.toString() //只好把数组作为字符串保存到application otherarray=new Array() otherarray=Application("array") for(i=0;i<=2;i++) Response.Write(" "+otherarray[i])%>网页输出:undefined undefined undefined请高手指点把数组数据保存在application的方法 js代码求助,堵住了 急,选项值丢失问题? 关于网站快捷通道的实现方法? 关于用JS调用记录的上一条与下一条。求助 请高手给点学javascript资料 如何在设定optionname.options[optionname.length]=new Option("name","value")时让其被选择? javascript中日期的比较怎么写 请问如何用JavaScript截断字符串? Jquery easyui 的tabs当切换的时候 有阴影 怎么解决 JS如何实现后台打开网页并关闭该网页 怎样向新建窗口写文字? 如何在iframe的网页中的script调用父页script中的变量
这样可以在其他asp页面里也能共享数组中的数据
vbs.asp
<%@language=vbscript%>
<%
dim myarray(10)
for i=1 to 10
myarray(i)=i
next
application("array")=myarray
'可以直接把数组保存至application对象
otherarray=application("array")
for i=1 to 10
otherarray(i)=i
response.write " "&otherarray(i)
next
'现在就可以共享数组中的数据了
%>
网页输出:
1 2 3 4 5 6 7 8 9 10而在javascript中直接把数组放到application中是无效的
js.asp
<%@language=javascript%>
<%
myarray=new Array(10)
for(i=0;i<=10;i++){
myarray[i]=i
}
//---------------------------------------------------------
//Application("array")=myarray.valueOf()
//试图把数组直接保存至applicatipn但是产生一个错误
//Application 对象, ASP 0197 (0x80004005)
//不能将具有单元模型特点的对象添加到应用程序的固有对象中
//--------------------------------------------------------- Application("array")=myarray.toString()
//只好把数组作为字符串保存到application
otherarray=new Array()
otherarray=Application("array")
for(i=0;i<=2;i++)
Response.Write(" "+otherarray[i])
%>网页输出:
undefined undefined undefined请高手指点把数组数据保存在application的方法