showModalDialog传数组参数

有些东西可能很简单,但你就是没用过,不知道怎么用,一下写的就是一个小例子。

暂且有两个界面

a.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<script language="javascript">
function a(obj) {
var arr = new Array();
arr[0]=obj.value;
arr[1]=obj._roomSid;
arr[2]=obj._customerName;
arr[3]=obj._customerMobile;
showModalDialog("b.htm",arr);
}
</script>
<input type="button" value="invoke" onclick="a()"/>
<input type="text" value="1" _roomSid="100" _customerName="孙超1" _customerMobile="13939085647" onclick="a(this)"/><br/>
<input type="text" value="0" _roomSid="101" _customerName="孙超2" _customerMobile="13939085611" onclick="a(this)"/><br/>
<input type="text" value="0" _roomSid="102" _customerName="孙超3" _customerMobile="13939085617" onclick="a(this)"/><br/>
<input type="text" value="0" _roomSid="103" _customerName="孙超4" _customerMobile="13939085627" onclick="a(this)"/><br/>
<input type="text" value="1" _roomSid="104" _customerName="孙超5" _customerMobile="13939085637" onclick="a(this)"/><br/>
</BODY>
</HTML>

 

b.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY onload="Init()">
<script language="javascript">
function Init() {
var arr = window.dialogArguments;
for (var i=0; i<arr.length;i++ )
{
alert(i+"--"+arr[i]);
}
}
</script>
</BODY>
</HTML>

 

 

你可能感兴趣的:(JavaScript,html)