大家看看我这个showModalDialog内select的值怎么返回给opener的select?

lauries 2004-07-15 10:24:49
我在body.htm上打开selUser.htm,现在想把selUser内的select所有的值返回给body.htm内的select,请问返回和怎么接收的函数怎么写?

====================================================
body.htm - 接收值的函数怎么写?

<html><head></head>
<script language="JavaScript">
function openwin(srcFile,obj,winFeatures)
{
window.showModalDialog(srcFile, obj, winFeatures);
}
</script>

<body>
<form action="" method="get" name="myForm">
<select name="selUser" size="4" multiple style="width:400px"></select>
<input type=button value=" 添加 " onclick="window.openwin('selUser.htm',myForm,'status:no;scrollbars:yes;help:no;dialogleft:400px;dialogtop:300px;dialogwidth:600px;dialogheight:400px')">
</form>
</body></html>

====================================================
selUser.htm - 传递值的函数怎么写?

<html><head></head>
<script language="JavaScript">
function AddUser()
{
//opener.addSel();
window.close();
}
</script>

<body>
<form action="" method="get" name="myForm">
<select name="selUser" size="3" multiple style="width:400px">
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>
<input name="button" type=button onclick="AddUser()" value=" 确认 ">
</form>
</body></html>

...全文
205 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
waiber 2004-07-15
  • 打赏
  • 举报
回复
弹出页面:

//此函数用于获取选中的值

function Select()
{
var IntcboLg=document.form1.selNode.length
var strcboValue=''
var strcboText=''
for (var i=0;i<IntcboLg;i++ )
{
if (strcboValue=='')
{
strcboValue=strcboValue+document.form1.selNode.options(i).value
strcboText=strcboText+document.form1.selNode.options(i).text
}else
{
strcboValue=strcboValue+','+document.form1.cboNode.options(i).value
strcboText=strcboText+','+document.form1.cboNode.options(i).text
}
}
if (strcboValue!=''){
var Strreturn=strcboValue+'#'+strcboText
window.returnValue=Strreturn
window.close();
}
}



接收页面:

function SelMutNode(url)
{

var strNode=showModalDialog(url',0,"dialogWidth:418px;dialogHeight:326px;status:no");
if (strNode!=-1 && typeof(strNode)!='undefined')
{
var strNodeary=strNode.split("#")
var strNodeID=strNodeary[0]
var strNodeName=strNodeary[1]
document.form1.txtNode.value=strNodeID;
document.form1.txtNode.value=strNodeName;
}

}


思路就是这样,自己去改改。
lauries 2004-07-15
  • 打赏
  • 举报
回复
谢,有启发作用

但是,我想把新开窗口selUser.htm内select的所有值全部转移到body.htm内的select中,两个select的值是一样的

这个问题我花了两三天的时间了,实在不会,寄托希望于此了
gamegod 2004-07-15
  • 打赏
  • 举报
回复
如果是想把第二页的东西增加到第一个页面,你看看我给你的代码,不知道是不是符合你的要求:
第一页:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>

<body>



<p><select size="8" name="txt">

<option>1</option>

</select></p>

<input type="button" onclick="window.open('in.htm')" value="Open">


</body>

</html>

第二页:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>

<script>
function CloseOpen() {

var ll=document.all.tags("input");

for(i=0;i<ll.length;i++)
{
if(ll[i].type=="checkbox")
{
if(ll[i].checked==true)
{
opener.document.all.txt.length=opener.document.all.txt.length+1;
opener.document.all.txt.options[opener.document.all.txt.length-1].text="123";
opener.document.all.txt.options[opener.document.all.txt.length-1].value=i;
}

}

}
window.close();
}
</script>
<body onunload="">
<p><input type="checkbox" name="C1" value="1">11</p>
<p><input type="checkbox" name="C1" value="2">21</p>
<p><input type="checkbox" name="C1" value="3">31</p>
<p><input type="checkbox" name="C1" value="4">41</p>
<p><input type="checkbox" name="C1" value="5">51</p>
<p><input type="checkbox" name="C1" value="6">61</p>
<p><input type="checkbox" name="C1" value="7">71</p>
<p><input type="button" onclick="javascript:CloseOpen();" value="close"></p>
</body>

</html>
lauries 2004-07-15
  • 打赏
  • 举报
回复
谢谢,谢谢大家,包括UP的“同志”,稍微整理了一下,代码是下面的:

body.htm

<html>
<head>
</head>
<script language="JavaScript">
function SelMutNode(url)
{
var obj=document.form1 ;
var strNode=showModalDialog(url,obj,"dialogWidth:418px;dialogHeight:326px;status:no");

var ret_val = strNode;
alert(ret_val)
if (ret_val!=null)
{
var strNodeary=ret_val.split("#");
var strNodeID=strNodeary[0];
var strNodeName=strNodeary[1]
//循环写值1,2,3 aaa,bbb,ccc
alert(strNodeID + " " + strNodeName);
a=strNodeID.split(",")
b=strNodeName.split(",")
for(i=0;i<a.length;i++)
document.form1.txtNode.options[document.form1.txtNode.options.length] = new Option(b[i],a[i])
}

}


//-->
</script>

<body>
<form action="" method="get" name="form1">
<select name="txtNode" size="4" multiple style="width:400px"></select>
<input type=button value=" add " onclick="SelMutNode('selUser.htm')">
<input type="hidden" value="" name="retval">
</form>
</body>
</html>

selUser.htm

<html>
<head>
</head>
<script language="JavaScript">
function Select()
{
var f = window.dialogArguments;
var IntcboLg=document.form1.selNode.length;
var strcboValue='';
var strcboText='';
for (var i=0;i<IntcboLg;i++ )
{
if (strcboValue=='')
{
strcboValue=strcboValue+document.form1.selNode.options(i).value;
strcboText=strcboText+document.form1.selNode.options(i).text;
}else
{
strcboValue=strcboValue+','+document.form1.selNode.options(i).value;
strcboText=strcboText+','+document.form1.selNode.options(i).text;
}
}
if (strcboValue!=''){
var Strreturn=strcboValue+'#'+strcboText;
f.retval.value=Strreturn;
window.returnValue=Strreturn
window.close();
}
}

</script>

<body>
<form action="" method="get" name="form1">
<select name="selNode" size="3" multiple style="width:400px">
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>
<input name="button" type=button onclick="Select()" value="¡¡Confirm¡¡">
</form>
</body>
</html>

希望此贴可以帮助到所有有这个需要的人
孟子E章 2004-07-15
  • 打赏
  • 举报
回复
大概yisi


<html>
<head>
</head>
<script language="JavaScript">
function SelMutNode(url)
{
var obj=document.form1 ;
var strNode=showModalDialog(url,obj,"dialogWidth:418px;dialogHeight:326px;status:no");

var ret_val = strNode;
alert(ret_val)
if (ret_val!=null)
{
var strNodeary=ret_val.split("#");
var strNodeID=strNodeary[0];
var strNodeName=strNodeary[1]
//循环写值1,2,3 aaa,bbb,ccc
alert(strNodeID + " " + strNodeName);
a=strNodeID.split(",")
b=strNodeName.split(",")
for(i=0;i<a.length-1;i++)
document.form1.txtNode.options[document.form1.txtNode.options.length] = new Option(b[i],a[i])
}

}


//-->
</script>

<body>
<form action="" method="get" name="form1">
<select name="txtNode" size="4" multiple style="width:400px"></select>
<input type=button value=" add " onclick="SelMutNode('selUser.htm')">
<input type="hidden" value="" name="retval">
</form>
</body>
</html>
lauries 2004-07-15
  • 打赏
  • 举报
回复
再次修改了下,能够得到值了,但是我又写不进去body.htm的select中


===============================
body.htm //alert显示我已经把值取过来了

<html>
<head>
</head>
<script language="JavaScript">
function SelMutNode(url)
{
var obj=document.form1 ;
var strNode=showModalDialog(url,obj,"dialogWidth:418px;dialogHeight:326px;status:no");

var ret_val = obj.retval.value;
if (ret_val!=-1 && typeof(ret_val)!='undefined')
{
var strNodeary=ret_val.split("#");
var strNodeID=strNodeary[0];
var strNodeName=strNodeary[1]
//循环写值1,2,3 aaa,bbb,ccc
alert(strNodeID + " " + strNodeName);
document.form1.txtNode.value=strNodeID;
document.form1.txtNode.value=strNodeName;
}

}


//-->
</script>

<body>
<form action="" method="get" name="form1">
<select name="txtNode" size="4" multiple style="width:400px"></select>
<input type=button value=" add " onclick="SelMutNode('selUser.htm')">
<input type="hidden" value="" name="retval">
</form>
</body>
</html>

===========================================================================

selUser.htm

<html>
<head>
</head>
<script language="JavaScript">
function Select()
{
var f = window.dialogArguments;
var IntcboLg=document.form1.selNode.length;
var strcboValue='';
var strcboText='';
for (var i=0;i<IntcboLg;i++ )
{
if (strcboValue=='')
{
strcboValue=strcboValue+document.form1.selNode.options(i).value;
strcboText=strcboText+document.form1.selNode.options(i).text;
}else
{
strcboValue=strcboValue+','+document.form1.selNode.options(i).value;
strcboText=strcboText+','+document.form1.selNode.options(i).text;
}
}
if (strcboValue!=''){
var Strreturn=strcboValue+'#'+strcboText;
f.retval.value=Strreturn;
window.returnValue=Strreturn
window.close();
}
}

</script>

<body>
<form action="" method="get" name="form1">
<select name="selNode" size="3" multiple style="width:400px">
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>
<input name="button" type=button onclick="Select()" value="¡¡Confirm¡¡">
</form>
</body>
</html>

上面代码显示已经取到值了,但是没有写入body.htm的select中,????
lauries 2004-07-15
  • 打赏
  • 举报
回复
net_lover(孟子E章) 老师:

我根据您提供的修改了部分脚本,可以提示不支持此对象
lauries 2004-07-15
  • 打赏
  • 举报
回复
net_lover(孟子E章) 老师:

您帮我改改这个文件,我花了几天时间了,实在是不知道了,只好求助于大家了!
我还没有学好这些!
孟子E章 2004-07-15
  • 打赏
  • 举报
回复
http://dev.csdn.net/develop/article/15/15113.shtm
孟子E章 2004-07-15
  • 打赏
  • 举报
回复
var strNode=showModalDialog(url,window,"dialogWidth:418px;dialogHeight:326px;status:no");



window.dialogArguments.document.form1.sel1.options[window.dialogArguments.document.form1.sel1.length] = new Option("txt","value",true,true)
window.returnValue=Strreturn
lauries 2004-07-15
  • 打赏
  • 举报
回复
测试没有成功,代码改写为一下:

====================================================
body.htm

<html><head></head>
<script language="JavaScript">
function SelMutNode(url)
{

var strNode=showModalDialog(url,0,"dialogWidth:418px;dialogHeight:326px;status:no");
if (strNode!=-1 && typeof(strNode)!='undefined')
{
var strNodeary=strNode.split("#")
var strNodeID=strNodeary[0]
var strNodeName=strNodeary[1]
document.form1.selNode.value=strNodeID;
document.form1.selNode.text=strNodeName;
}

}

//-->
</script>

<body>
<form action="" method="get" name="form1">
<select name="selNode" size="4" style="width:400px"></select>
<input type=button value=" add " onclick="SelMutNode('selUser.htm')">
</form>
</body></html>


====================================================
selUser.htm

<html><head></head>
<script language="JavaScript">
function Select()
{
var IntcboLg=document.form1.selNode.length
var strcboValue=''
var strcboText=''
for (var i=0;i<IntcboLg;i++ )
{
if (strcboValue=='')
{
strcboValue=strcboValue+','+document.form1.selNode.options(i).value
strcboText=strcboText+','+document.form1.selNode.options(i).text
}else
{
strcboValue=strcboValue+','+document.form1.selNode.options(i).value
strcboText=strcboText+','+document.form1.selNode.options(i).text
}
}
if (strcboValue!=''){
var Strreturn=strcboValue+'#'+strcboText
window.returnValue=Strreturn
window.close();
}
}

</script>

<body>
<form action="" method="get" name="form1">
<select name="selNode" size="3" multiple style="width:400px">
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>
<input name="button" type=button onclick="Select()" value="¡¡Confirm¡¡">
</form>
</body></html>

========================================
可是我测试结果,总是不能传递值?????
lauries 2004-07-15
  • 打赏
  • 举报
回复
测试ing

从此发现不大会javascript就玩完
javascript函数的解释,解释了具体函数的功能,一、函数JavaScript函数集合 1.document.write(""); 输出语句 2.JS中的注释为// 3.传统的HTML文档顺序是:document->html->(head,body) 4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document) 5.得到表单中元素的名称和:document.getElementById("表单中元素的ID号").name(或value) 6.一个小写转大写的JS: document.getElementById("output").value = document.getElementById("input").value.toUpperCase(); 7.JS中的类型:String,Number,Boolean,Null,Object,Function 8.JS中的字符型转换成数型:parseInt(),parseFloat() 9.JS中的数字转换成字符型:(""+变量) 10.JS中的取字符串长度是:(length) 11.JS中的字符与字符相连接使用+号. 12.JS中的比较操作符有:==等于,!=不等于,>,>=,<.<= 13.JS中声明变量使用:var来进行声明 14.JS中的判断语句结构:if(condition){}else{} 15.JS中的循环结构:for([initial expression];[condition];[upadte expression]) {inside loop} 16.循环中止的命令是:break 17.JS中的函数定义:function functionName([parameter],...){statement[s]} 18.当文件中出现多个form表单时.可以用document.forms[0],document.forms[1]来代替. 19.窗口:打开窗口window.open(), 关闭一个窗口:window.close(), 窗口本身:self 20.状态栏的设置:window.status="字符"; 21.弹出提示信息:window.alert("字符"); 22.弹出确认框:window.confirm(); 23.弹出输入提示框:window.prompt(); 24.指定当前显示链接的位置:window.location.href="URL" 25.取出窗体中的所有表单的数量:document.forms.length 26.关闭文档的输出流:document.close(); 27.字符串追加连接符:+= 28.创建一个文档元素:document.createElement(),document.createTextNode() 29.得到元素的方法:document.getElementById() 30.设置表单中所有文本型的成员的为空: var form = window.document.forms[0] for (var i = 0; i返回TRUE或FALSE) 32.单选按钮组(单选按钮的名称必须相同):取单选按钮组的长度document.forms[0].groupName.length 33.单选按钮组判断是否被选中也是用checked. 34.下拉列表框的:document.forms[0].selectName.options[n].value (n有时用下拉列表框名称加上.selectedIndex来确定被选中的) 35.字符串的定义:var myString = new String("This is lightsword"); 36.字符串转成大写:string.toUpperCase(); 字符串转成小写:string.toLowerCase(); 37.返回字符串2在字符串1中出现的位置:String1.indexOf("String2")!=-1则说明没找到. 38.取字符串中指定位置的一个字符:StringA.charAt(9); 39.取出字符串中指定起点和终点的子字符串:stringA.substring(2,6); 40.数学函数:Mat
107个常用javascript语句 -7.焦点 .focus(); -6.捕获对象通用方法 function $(obj) {return document.getElementById(obj);} -5.字符串赋数组var array=new Array(); array=tdrczpdata.split(''); -4;Request[""]; -3.常用iframe -2.常用 //错误提示 function AlertErrorMeg(meg){ alert(meg); } //提示转向 function AlertRedirect(meg,url){ alert(meg); window.location.assign(url); } -1.动态绑定方法$('JournalList1').attachEvent("onchange", onchangList); 0.数组赋给下拉菜单state_select.options.length = state_select_num ; for( i=1 ; ihtml->(head,body) 4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document) 5.得到表单中元素的名称和:document.getElementById("表单中元素的ID號").name(或value) 6.一个小写转大写的JS: document.getElementById("output").value = document.getElementById("input").value.toUpperCase(); 7.JS中的类型:String,Number,Boolean,Null,Object,Function 8.JS中的字符型转换成数型:parseInt(),parseFloat() 9.JS中的数字转换成字符型:(""+变量) var a=2;var b=""+a; 10.JS中的取字符串长度是:(length) 11.JS中的字符与字符相连接使用 號. 12.JS中的比较操作符有:==等于,!=不等于,>,>=,<.<= 13.JS中声明变量使用:var来进行声明 14.JS中的判断语句结构:if(condition){}else{} 15.JS中的循环结构:for([initial expression];[condition];[upadte expression]) {inside loop} 16.循环中止的命令是:break 17.JS中的函数定义:function functionName([parameter],...){statement[s]} 18.当文件中出现多个form表单时.可以用document.forms[0],document.forms[1]来代替. 19.窗口:打开窗口window.open(), 关闭一个窗口:window.close(), 窗口本身:self "fullscreen=no,channelmode=no,toolbar=no,location=no,menubar=no,scrollbas=no,resizable=no," 20.状態栏的设置:window.status="字符"; 21.弹出提示信息:window.alert("字符"); 22.弹出確认框:window.confirm(); 23.弹出输入提示框:window.prompt(); 24.指定当前显示链接的位置:window.location.href="URL" 25.取出窗体中的所有表单的数量:document.forms.length 26.关闭文档的输出流:document.close(); 27.字符串追加连接符: = 28.创建一个文档元素:document.createElement(),document.createTextNode() 29.得到元素的方法:document.getElementById() 30.设置表单中所有文本型的成员的为空: var form = window.document.forms[0] for (var i = 0; i返回TRUE或FALSE) 32.单选按钮组(单选按钮的名称必须相同):取单选按钮组的长度document.forms[0].groupName.length 33.单选按钮组判断是否被选中也是用checked. 34.下拉列表框的:document.forms[0].selectName.options[n].value (n有时用下拉列表框名称加上.selectedIndex来確定被选中的) 35.字符串的定义:var myString = new String("This is lightsword"); 36.字符串转成大写:string.toUpperCase(); 字符串转成小写:string.toLowerCase(); 37.返回字符串2在字符串1中出现的位置:String1.indexOf("String2")!=-1则说明没找到. 38.取字符串中指定位置的一个字符:StringA.charAt(9); 39.取出字符串中指定起点和终点的子字符串:stringA.substring(2,6); 40.数学函数:Math.PI(返回圆周率),Math.SQRT2(返回开方),Math.max(value1,value2)返回两个数中的最在,Math.pow(value1,10)返回 value1的十次方,Math.round(value1)四舍五入函数,Math.floor(Math.random()*(n 1))返回隨机数 41.定义日期型变量:var today = new Date(); 42.日期函数列表:dateObj.getTime()得到时间,dateObj.getYear()得到年份,dateObj.getFullYear()得到四位的年份,dateObj.getMonth()得 到月份,dateObj.getDate()得到日,dateObj.getDay()得到日期几,dateObj.getHours()得到小时,dateObj.getMinutes()得到 分,dateObj.getSeconds()得到秒,dateObj.setTime(value)设置时间,dateObj.setYear(val)设置年,dateObj.setMonth(val)设置 月,dateObj.setDate(val)设置日,dateObj.setDay(val)设置星期几,dateObj.setHours设置小时,dateObj.setMinutes(val)设置 分,dateObj.setSeconds(val)设置秒 [注意:此日期时间从0开始计] 43.FRAME的表示方式: [window.]frames[n].ObjFuncVarName,frames["frameName"].ObjFuncVarName,frameName.ObjFuncVarName 44.parent代表父亲对象,top代表最顶端对象 45.打开子窗口的父窗口为:opener 46.表示当前所属的位置:this 47.当在超链接中调用JS函数时用:(javascript :)来开头后面加函数名 48.在老的浏览器中不执行此JS: 49.引用一个文件式的JS: 50.指定在不支持脚本的浏览器显示的HTML: 51.当超链和onCLICK事件都有时,则老版本的浏览器转向a.html,否则转向b.html.例:dfsadf 52.JS的內建对象 有:Array,Boolean,Date,Error,EvalError,Function,Math,Number,Object,RangeError,ReferenceError,RegExp,String,SyntaxError,TypeErr or,URIError 53.JS中的换行:\n 54.窗口全屏大小:function fullScreen(){ this.moveTo (0,0);this.outerWidth=screen.availWidth;this.outerHeight=screen.availHeight;}window.maximize=fullScreen; 55.JS中的all代表其下层的全部元素 56.JS中的焦点顺序:document.getElementByid("表单元素").tabIndex = 1 57.innerHTML的是表单元素的:如"how are you",则innerHTML的就是:how are you 58.innerTEXT的和上面的一样,只不过不会把这种標记显示出来. 59.contentEditable可设置元素是否可被修改,isContentEditable返回是否可修改的状態. 60.isDisabled判断是否为禁止状態.disabled设置禁止状態 61.length取得长度,返回整型数 62.addBehavior()是一种JS调用的外部函数文件其扩展名为.htc 63.window.focus()使当前的窗口在所有窗口之前. 64.blur()指失去焦点.与FOCUS()相反. 65.select()指元素为选中状態. 66.防止用户对文本框中输入文本:onfocus="this.blur()" 67.取出该元素在页面中出现的数量:document.all.tags("div(或其它HTML標记符)").length 68.JS中分为两种窗体输出:模態和非模態.window.showModaldialog(),window.showModeless() 69.状態栏文字的设置:window.status='文字',默认的状態栏文字设置:window.defaultStatus = '文字.'; 70.添加到收藏夹:external.AddFavorite(""); 71.JS中遇到脚本错误时不做任何操作:window.onerror = doNothing; 指定错误句柄的语法为:window.onerror = handleError; 72.JS中指定当前打开窗口的父窗口:window.opener,支持opener.opener...的多重继续. 73.JS中的self指的是当前的窗口 74.JS中状態栏显示內容:window.status="內容" 75.JS中的top指的是框架集中最顶层的框架 76.JS中关闭当前的窗口:window.close(); 77.JS中提出是否確认的框:if(confirm("Are you sure?")){alert("ok");}else{alert("Not Ok");} 78.JS中的窗口重定向:window.navigate("";); 79.JS中的打印:window.print() 80.JS中的提示输入框:window.prompt("message","defaultReply"); 81.JS中的窗口滚动条:window.scroll(x,y) 82.JS中的窗口滚动到位置:window.scrollby 83.JS中设置时间间隔:setInterval("expr",msecDelay)或setInterval(funcRef,msecDelay)或setTimeout 84.JS中的模態显示在IE4 行,在NN中不行:showModalDialog("URL"[,arguments][,features]); 85.JS中的退出之前使用的句柄:function verifyClose(){event.returnValue="we really like you and hope you will stay longer.";}} window.=verifyClose; 86.当窗体第一次调用时使用的文件句柄:onload() 87.当窗体关闭时调用的文件句柄:onunload() 88.window.location的属性: protocol(http:),hostname( ("/a/a.html"),hash("#giantGizmo",指跳转到相应的锚记),href(全部的信息) 89.window.location.reload()刷新当前页面. 90.window.history.back()返回上一页,window.history.forward()返回下一页,window.history.go(返回第几页,也可以使用访问过的URL) 91.document.write()不换行的输出,document.writeln()换行输出 92.document.body.noWrap=true;防止链接文字折行. 93.变量名.charAt(第几位),取该变量的第几位的字符. 94."abc".charCodeAt(第几个),返回第几个字符的ASCii码. 95.字符串连接:string.concat(string2),或用 =进行连接 96.变量.indexOf("字符",起始位置),返回第一个出现的位置(从0开始计算) 97.string.lastIndexOf(searchString[,startIndex])最后一次出现的位置. 98.string.match(regExpression),判断字符是否匹配. 99.string.replace(regExpression,replaceString)替换现有字符串. 100.string.split(分隔符)返回一个数组存储. 101.string.substr(start[,length])取从第几位到指定长度的字符串. 102.string.toLowerCase()使字符串全部变为小写. 103.string.toUpperCase()使全部字符变为大写. 104.parseInt(string[,radix(代表进制)])强制转换成整型. 105.parseFloat(string[,radix])强制转换成浮点型. 106.isNaN(变量):测试是否为数型. 107.定义常量的关键字:const,定义变量的关键字:var toString(Array.toString 方法) public toString() : String 返回一个字符串,该表示所指定的 Array 对象中的元素。数组中的每一个元素(从索引 0 开始到最高索引结束)均会转换为一个连接字 符串,并以逗号分隔。若要指定自定义的分隔符,请使用 Array.join() 方法。 可用性:ActionScript 1.0;Flash Player 5 返回 String - 一个字符串。 示例 下面的示例创建 my_array,并将其转换为字符串。 var my_array:Array = new Array(); my_array[0] = 1; my_array[1] = 2; my_array[2] = 3; my_array[3] = 4; my_array[4] = 5; trace(my_array.toString()); // Displays 1,2,3,4,5. 此示例输出 1、2、3、4、5 作为 trace 语句的结果。 数组: 新建:var ary = new Array(); 或 var ary = []; 增加:ary.push(value); 删除:delete ary[n]; 遍历:for ( var i=0 ; i < ary.length ; ++i ) ary[i];

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧