function checkRadio()
{
document.form1.action = document.form1.log-type[0].checked ? "aaa.php" : "bbb.php";
document.form1.submit();
}
{
document.form1.action = document.form1.log-type[0].checked ? "aaa.php" : "bbb.php";
document.form1.submit();
}
解决方案 »
- 新手求助!PHP问题。。祝好人一声平安
- 采集图片问题 (急)高人帮我看看
- 关于php处理ajax请求的困惑
- php支持try,catch吗?
- PHP如何直接读取来自<input type="file" name="m_file">的文件内容(纯文本)?
- zend studio里面怎样将字体放大点?
- PHP 抓取数据问题~!!在线等啊~!!
- 用phpmyadmin导入数据后,很多繁体字都显示不了。
- php怎么样判断多个post值是否为空
- php 操作oracle的问题,为什么select会差一条记录?
- 急!PHP无法正常绘图,GD已经加载了,也找不出设置上的问题,代码是PHP.net上的源码
- 请问谁有用过prado框架啊??
<script language="javascript">
function checkRadio()
{
if (document.form1.log-type[0].checked)
{
document.form1.action="aaa.php";
document.form1.submit();
if (document.form1.log-type[1].checked)
{
document.form1.action="bbb.php";
document.form1.submit();
}
}
<form name=form1 method=post onSubmit="return checkRadio(); ">
.....
<TD><INPUT type=radio CHECKED value=person name=log-type >个人</TD>
<TD><INPUT type=radio value=company name=log-type >单位</TD>
...
</form>
你写的和我的代码没区别,我有个疑问,是不是form中的action不能为空啊
function checkRadio()
{
document.form1.action = document.form1.log-type[0].checked ? "aaa.php" : "bbb.php";
document.form1.submit();
}
</script><form name=form1 method=post onSubmit="return checkRadio(); ">
.....
<TD><INPUT type=radio CHECKED value=person name=log-type >个人</TD>
<TD><INPUT type=radio value=company name=log-type >单位</TD>
...
</form>
我希望通过不同的radio选择(如我选择“个人”或“公司”按钮,提交到不同的页面处理,选择个人时,提交给“http://tt.173.com/aaa.php"处理,
选择公司时,提交给“http://www.173.com/tt/aaa.php "处理)
不同的Radio选择,其实是用同一个页面aaa.php处理的,只不过,aaa.php放在不同的文件中,
下面是我写的代码,但达不到我想的效果,不知道错在哪里,各位帮看一下。
<script language="javascript">
function checkRadio()
{
if (document.form1.log-type[0].checked)
{
document.form1.action=" http://tt.173.com/aaa.php ";
document.form1.submit();
if (document.form1.log-type[1].checked)
{
document.form1.action=" http://www.173.com/tt/aaa.php ";
document.form1.submit();
}
}<form name=form1 method=post onSubmit="return checkRadio(); ">
.....
<TD><INPUT type=radio CHECKED value=person name=log-type >个人</TD>
<TD><INPUT type=radio value=company name=log-type >单位</TD>
...
</form>
改为
document.form1['log-type'][0].checked其他类同document.form1.log-type[0].checked
将被误解为
document.form1.log - type[0].checked
而document.form1.log和type[0].checked都不是合法的对象,也不能做减法运算