---
title: "第一次进有下拉框的页面在没有选择的情况下，部门、日期传递导出问题"
author: "primarykeylw"
date: "2012-08-08T17:12:24Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2012-08-08T17:12:24Z"
id: 1625593
url: "https://primarykeylw.iteye.com/blog/1625593"
---

页面：

```java

<!-- <a href="#" onclick="function(){distribute!export.action?ddept=${ddept}&planDateStr=${planDateStr}&mflag=export}"> -->
	 			<!-- <a href="javascript:this.frmServices.submit();"> -->
	 			<a href="#" onclick="expt();"> 
			      <img src="${ctx}/img/button_excel.jpg" border="0" width="67" height="23" alt="导出"> 
				</a>
				&nbsp;&nbsp;
				<!--<a href="${ctx}/duty/distribute/distribute!listDisplay.action?year=${year}&month=${month}&planDateStr=${planDateStr}&ddept=${ddept}&mflag=print";>-->
			    <a href="#" onclick="prnt();"> 
			      <img src="${ctx}/img/button_print.jpg" border="0" width="67" height="23" alt="打印"> 
				</a>
				&nbsp;&nbsp;
				<a href="${ctx}/duty/distribute/distribute-query.action">
			      <img src="${ctx}/img/button_return.jpg" border="0" width="67" height="23" alt="返回"> 
				</a>



<!-- 下面的js处理 得到第一次进来下拉框没有选择的时候的值 -->
//第一次进来下拉框的值传递,并导出
function expt(){
	var v1=document.getElementById("ddept").value;
	var v2=document.getElementById("planDateStr").value;
	//alert(v1);
	var url="${ctx}/duty/distribute/distribute!listDisplay.action?ddept="+v1+"&planDateStr="+v2+"&mflag=export";
	document.URL=url;
}

//第一次进来下拉框的值传递,并打印
function prnt(){
	var v1=document.getElementById("ddept").value;
	var v2=document.getElementById("planDateStr").value;
	var vm=document.getElementById("month").value;
	var vy=document.getElementById("year").value;
	//alert(v1);
	var url="${ctx}/duty/distribute/distribute!listDisplay.action?year="+vy+"&month="+vm+"&planDateStr="+v2+"&ddept="+v1+"&mflag=print";
	document.URL=url;
}
```