<!--
个人认为form的default method 是 ”post“,action后的#/?相同的效果,“.”代表current folder。
<form action="#"<?php if (isset($_GET['sample'])) echo "&"; ?>&this.data_format.value name=format_form>
<?php
if (isset($_GET['sample']))
echo "<input type=hidden name='sample' value=" . $_GET['sample'] .">";
// note the space before "/>"
?>
-->
<form action="#" method=get name=format_form>
<?php
if (isset($_GET['sample']))
echo "<input type=hidden name='sample' value=" . $_GET['sample'] .">";
?>
显示格式选择
<SELECT size=1 name="data_format" οnchange="submit()">
<OPTION value="0" <?php if ($format==0) echo "selected"; ?> >简略</OPTION>
<OPTION value="1" <?php if ($format==1) echo "selected"; ?> >详细</OPTION>
</select>
-----------------------------------------如何用js改变form的action属性值-------------------------
只要将form设定一个id如id=“form1”,然后在submit的时候调用js函数,在函数中引用=
"?margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; color:rgb(69,69,69); font-family:'Microsoft Yahei',微软雅黑,Tahoma,Arial,Helvetica,STHeiti; font-size:14px; line-height:25px"> Eg:
<script lang="javascript">
function go()
{
var value=("T1").value;
="?cx="+value;
}
</script>
引用该函数的form:
<form method=post οnsubmit="go();">
我的方法:
if (document.form1.search_option1.value=="data" )
{
document. = ""; //js control the form by id,not name
document.form1.search_option2. = 1;
document.form1.search_option2.options[0] = new Option("Dataset");
document.form1.search_option2.options[0].value = "Dataset_ID"; // 文本型value 必须用""
document.form1.search_option2.options[1] = new Option("位址");
document.form1.search_option2.options[1].value = "site";
document.form1.search_option2.selectedIndex = 0;
}
引用的form
<form action="b1_customer.php" method=post name="from1" >
<SELECT onChange=checkSearch() size=1 name="search_option1" >xxxx</select>
<SELECT size=1 name="search_option2" >xxx</select>
记于2010.9.13 黯風夜隱