關(guān)于靜態(tài)頁生成問題 突破form數(shù)量限制
更新時間:2006年09月20日 00:00:00 作者:
我們知道生成靜態(tài)頁,一般用模板的方式,這個我是會的,現(xiàn)在我想直接將ASP文件生成的HTML代碼存成靜態(tài)頁,這個非常適合做首頁,于時我在網(wǎng)上找這方面的內(nèi)容,找到這個:《不用模板只用ASP+FSO生成靜態(tài)HTML頁的一個方法》:http://www.dbjr.com.cn/html/200609/984.htm,我試了一下,一般能辦,但文件大時,就會出錯,到底是什么原因呢?是textarea存儲的文件有限制還是其他,反復(fù)上網(wǎng)查,同時在IECN發(fā)表帖子求助,我反復(fù)試驗,發(fā)現(xiàn)是表單有限制,在網(wǎng)上找到了解決FORM的限制問題,
下面是轉(zhuǎn)貼:
當(dāng)表單發(fā)送的數(shù)據(jù)量很大時,就會報錯。查閱msdn了解到,原因是微軟對用request.form()可接收的最大數(shù)據(jù)有限制,iis4中為80k字節(jié),iis5中為100k字節(jié)。
下面是微軟提供的幾個解決方法:
1、用request.binaryread 代替 request.form方法 來解析表單數(shù)據(jù);
2、使用文件上傳方案,比如:microsoft posting acceptor;
3、由于102399字節(jié)的限制是對每個表單元素的,所以在提交時,把表單元素內(nèi)容大于102399的分隔成多個表單元素來提交。
下面為示例代碼:(微軟提醒:下面代碼不一定完全適用特定的需要,不對使用這些代碼產(chǎn)生的后果負(fù)責(zé)?。?nbsp;
<form method=post action=largepost.asp name=theform onsubmit="breakitup()">
<textarea rows=3 cols=100 name=bigtextarea>a bunch of text...</textarea>
<input type=submit value=go>
</form>
<script language=javascript>
function breakitup()
{
//set the limit for field size.
//如果內(nèi)容有中文的字符的話,可以設(shè)置為:51100
var formlimit = 102399
//get the value of the large input object.
var tempvar = new string
tempvar = document.theform.bigtextarea.value
//if the length of the object is greater than the limit, break it
//into multiple objects.
if (tempvar.length > formlimit)
{
document.theform.bigtextarea.value = tempvar.substr(0, formlimit)
tempvar = tempvar.substr(formlimit)
while (tempvar.length > 0)
{
var objtextarea = document.createelement("textarea")
objtextarea.name = "bigtextarea"
objtextarea.value = tempvar.substr(0, formlimit)
document.theform.appendchild(objtextarea)
tempvar = tempvar.substr(formlimit)
}
}
}
</script>
接受數(shù)據(jù)頁主要代碼:
<%
dim bigtextarea
for i = 1 to request.form("bigtextarea").count
bigtextarea = bigtextarea & request.form("bigtextarea")(i)
next
%>
第一種也是有限制,我采用了第三種,終于成功了。
下面是轉(zhuǎn)貼:
當(dāng)表單發(fā)送的數(shù)據(jù)量很大時,就會報錯。查閱msdn了解到,原因是微軟對用request.form()可接收的最大數(shù)據(jù)有限制,iis4中為80k字節(jié),iis5中為100k字節(jié)。
下面是微軟提供的幾個解決方法:
1、用request.binaryread 代替 request.form方法 來解析表單數(shù)據(jù);
2、使用文件上傳方案,比如:microsoft posting acceptor;
3、由于102399字節(jié)的限制是對每個表單元素的,所以在提交時,把表單元素內(nèi)容大于102399的分隔成多個表單元素來提交。
下面為示例代碼:(微軟提醒:下面代碼不一定完全適用特定的需要,不對使用這些代碼產(chǎn)生的后果負(fù)責(zé)?。?nbsp;
復(fù)制代碼 代碼如下:
<form method=post action=largepost.asp name=theform onsubmit="breakitup()">
<textarea rows=3 cols=100 name=bigtextarea>a bunch of text...</textarea>
<input type=submit value=go>
</form>
<script language=javascript>
function breakitup()
{
//set the limit for field size.
//如果內(nèi)容有中文的字符的話,可以設(shè)置為:51100
var formlimit = 102399
//get the value of the large input object.
var tempvar = new string
tempvar = document.theform.bigtextarea.value
//if the length of the object is greater than the limit, break it
//into multiple objects.
if (tempvar.length > formlimit)
{
document.theform.bigtextarea.value = tempvar.substr(0, formlimit)
tempvar = tempvar.substr(formlimit)
while (tempvar.length > 0)
{
var objtextarea = document.createelement("textarea")
objtextarea.name = "bigtextarea"
objtextarea.value = tempvar.substr(0, formlimit)
document.theform.appendchild(objtextarea)
tempvar = tempvar.substr(formlimit)
}
}
}
</script>
接受數(shù)據(jù)頁主要代碼:
<%
dim bigtextarea
for i = 1 to request.form("bigtextarea").count
bigtextarea = bigtextarea & request.form("bigtextarea")(i)
next
%>
第一種也是有限制,我采用了第三種,終于成功了。
相關(guān)文章
asp中使用MSXML2.DOMDocument處理XML數(shù)據(jù)時的注意事項
這篇文章主要介紹了asp中使用MSXML2.DOMDocument處理XML數(shù)據(jù)時的注意事項,本文給出了4個需要注意的問題,需要的朋友可以參考下2014-08-08