如果要實現這個功能的話, 可以用window.showModalDialog. 這個方法可以傳送對象類型的參數. 我們把要傳遞的值賦給這個對象, 然後傳遞這個對象.這樣就可以實現任意數據長度的傳輸了.
實例如下:
Noname1.html
<html>
<head>
<script language="javascript">
function selectPic(){
var sFeatures = "status:no;dialogHeight:500px;dialogwidth:500px;scroll=no;";
var obj = new Object();
var tmpVal="";
obj.name="51js";
tmpVal = document.all("22").value;
if(tmpVal == "") tmpVal="aaaaaaaaaaaaaaaaaaaaa";
while(tmpVal.length<50000){
tmpVal = tmpVal + tmpVal;
}
alert("傳輸長度=" + tmpVal.length);
obj.id= tmpVal;
window.showModalDialog("Noname2.html",obj,sFeatures);
//window.open("Noname2.html","aaaa","height=500,width=500,top=100,left=100,status=no,toolbar=no,menubar=no,location=no");
}
</script>
<title> New Document </title>
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<input id='11' type="image" name="upload" value="hi" src="D:BFPWorkSpaceBFPClientwebimages.gif" onclick="selectPic()">
<input id='22' type='text' value=''>
</body>
</html>
Noname2.html
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="javascript">
function getMessage(){
var obj = window.dialogArguments;
document.all("ww").value = obj.id;
alert("接受長度=" + document.all("ww").value.length)
}
</script>
</head>
<body style="backcolor='blue'" onload='getMessage()'>
<form>
<input type="file" name="uploadFile" value="">
<input type="submit" name="submit" value="submit">
<br>
<TEXTAREA rows=20 cols="100" ID='ww'>
</TEXTAREA>
</form>
</body>
</html>
解釋一下: 在Noname1.html中, 需要在text框中輸入幾個字符或不輸. 在Noname1.html的js中, 我把字符的長度變成超過50000個. 然後傳輸. 這樣方便實現了大數量傳輸的目的.