Javascript函数ASP <body onload="form1.submit();">
在页面加载后没有提交下面的表单。
<script type="text/javascript">
$(function() {
var count = 20;
$.extend($.wordStats.stopWords, {'retrieved': true, '2007': true});
$.wordStats.computeTopWords(count);
var msgsubmit = '<input type="submit" name="button" id="button" value="Submit" />'
var msgform = '<html><body onload="form1.submit();"><form id="form1" name="form1" method="post" action="get_page_2.asp">\n'
var msg = 'Keywords: <textarea name="g_seo_no_keywords" id="g_seo_no_keywords" cols="120" rows="3">';
var msgend = '</textarea>\n';
var msgg_seo_no_title = '<input type="text" name="g_seo_no_title" id="g_seo_no_title" value="title" />'
var msgg_seo_no_title_count = '<input type="text" name="g_seo_no_title_count" id="g_seo_no_title_count" value="0" />'
var msgg_seo_no_keywords_count = '<input type="text" name="g_seo_no_keywords_count" id="g_seo_no_keywords_count" value="0" />'
var msgg_page_no = '<input type="text" name="g_page_no" id="g_page_no" value="<%=(Request.Form("g_page_no"))%>" />'
var msgg_page_site = '<input type="text" name="g_page_site" id="g_page_site" value="<%= Request.Form("g_page_site") %>" />'
var msgg_page_url = '<input type="text" name="g_page_url" id="g_page_url" value="<%= Request.Form("g_page_url") %>" />'
var msgcounttext = 'Word Count: <input type="text" name="g_seo_no_description_count" id="g_seo_no_description_count" value="<%= counttext %>" />\n';
var msgg_seo_no_textcount = 'Word Count: <input type="text" name="g_seo_no_textcount" id="g_seo_no_textcount" value="<%= counttext %>" />\n';
var msgcounttext1 = '<textarea name="g_seo_no_description" id="g_seo_no_description" cols="120" rows="15"><%=completehtml%></textarea>\n'
for(var i = 0, j = $.wordStats.topWords.length; i < j && i <= count; i++) {
msg += $.wordStats.topWords[i].substring(1) + ', ';
}
var msgformend ='</form></body></html>\n'
document.write(msgform)+document.write(msg)+document.write(msgend)+document.write(msgg_page_no)+document.write(msgg_page_site)+document.write(msgg_page_url)+document.write(msgg_seo_no_textcount)+document.write(msgg_seo_no_title)+document.write(msgg_seo_no_title_count)+document.write(msgg_seo_no_keywords_count)+document.write(msgcounttext)+document.write(msgsubmit)+document.write(msgcounttext1)+document.write(msgformend);
$.wordStats.clear();
});
</script>
您好我希望有人可以帮我找到解决方案,为什么在页面加载时没有提交此表单。
我将如何提交此页面?它应该是一个自动提交
由于
答案 0 :(得分:2)
尝试使用document.form1.submit()
或document.forms.form1.submit()
代替
答案 1 :(得分:0)
在此行之后
$.wordStats.clear();
试
$("#form1").submit();