【发布时间】:2016-09-11 04:25:26
【问题描述】:
您好,我正在尝试使用 html 编码从网页下载文件。 网页链接 =http://www.nrldc.org/WBS/injsch.aspx 如果我今天使用以下代码下载它,它工作正常。
<html>
<head>
<title>view injection schedule</title>
</head>
<body onload=form1.submit()>
<form name="form1" method="post" action="http://www.nrldc.org/wbs/injsch.aspx" id="form1">
<div>
<input type="hidden" name ="__EVENTTARGET" id="__EVENTTARGET" value="download" />
<input type="hidden" name ="__EVENTARGUMENT" id="__EVENTARGUMENT" value="filename.csv" />
</div>
<script type="text/javascript">
//<![cdata[
var theform = document.forms['form1'];
if (!theform) {
theform=document.form1;
}
function __dopostback(eventtarget,eventargument) {
if (!theform.onsubmit ||(theform.onsubmit() !=false)) {
theform.__eventtarget.value=eventtarget;
theform.__eventargument.value=eventargument;
theform.submit();
}
}
//]]>
</script>
</html>
现在在日期字段中,我想选择明天的日期,然后下载 csv 。我做不到。请提供任何帮助/建议。
【问题讨论】:
标签: javascript html csv