做一个查询手机系统,销售可以选择时间,库存查询时为当前库存不需要时间选择。两个功能做在一个页面。由于还不涉及javascript,活学活用了一把javascript。功能达到了,但是问题出来了,请看图,日期换了行,起始日期应该一行显示!请各位老大指教,谢谢! 。
<html><head><title>test javascript</title><script language="javascript"><!-- function selType(){ var obj=document.getElementById("change"); if(obj.value=="sale"){ sel.sett1.style.display="block"; sel.sett2.style.display="block"; }else{ sel.sett1.style.display="none"; sel.sett2.style.display="none"; } }--></script></head><body><form id="sel" name="sel" action="???" method="post"> <select name="sale" id="change" onchange="selType()"> <option value="sale">销售</option> <option value="stock">库存</option> <input type="text" id="sett1" style="display:block" name="startdate" value=<?php echo date('Ymd',strtotime('-30 day'));?> size ='8' /> -<input type="text" id="sett2" style="display:block" name="enddate" value=<?php echo date('Ymd',strtotime('-0 day')); ?> size='8' /></form> </body></html>
style="display:block"
用了block?然??行了,改?inline
<html><head><title>test javascript</title><script language="javascript"><!-- function selType(){ var obj=document.getElementById("change"); if(obj.value=="sale"){ sel.sett1.style.display="inline"; sel.sett2.style.display="inline"; }else{ sel.sett1.style.display="none"; sel.sett2.style.display="none"; } }--></script> </head><body><form id="sel" name="sel" action="???" method="post"> <select name="sale" id="change" onchange="selType()"> <option value="sale">销售</option> <option value="stock">库存</option> </select> <input type="text" id="sett1" style="display:inline" name="startdate" value="<?php echo date('Ymd',strtotime('-30 day'));?>" size ='8' /> -<input type="text" id="sett2" style="display:inline" name="enddate" value="<?php echo date('Ymd',strtotime('-0 day')); ?>" size='8' /></form> </body></html>
style="display:block"
用了block?然??行了,改?inline
<html><head><title>test javascript</title><script language="javascript"><!-- function selType(){ var obj=document.getElementById("change"); if(obj.value=="sale"){ sel.sett1.style.display="inline"; sel.sett2.style.display="inline"; }else{ sel.sett1.style.display="none"; sel.sett2.style.display="none"; } }--></script> </head><body><form id="sel" name="sel" action="???" method="post"> <select name="sale" id="change" onchange="selType()"> <option value="sale">销售</option> <option value="stock">库存</option> </select> <input type="text" id="sett1" style="display:inline" name="startdate" value="<?php echo date('Ymd',strtotime('-30 day'));?>" size ='8' /> -<input type="text" id="sett2" style="display:inline" name="enddate" value="<?php echo date('Ymd',strtotime('-0 day')); ?>" size='8' /></form> </body></html>