|
|
|
| Помогите, скажите можно ли сделать так.
Есть форма и две кнопки, при нажатии на одну submitить форму в файл lalala.html а при нажатии на вторую lalala.html?id=1 | |
|
|
|
|
|
|
|
для: kail_braslovski
(14.04.2007 в 08:23)
| |
<form name=form1 method=post>
...
<input type=button name=but1 onclick=func(this.name)>
<input type=button name=but2 onclick=func(this.name)>
</form>
<script>
function func(but_name)
{
if(but_name=='but1')
{
document.forms['form1'].setAttribute('action','lalala.html');
document.forms['form1'].submit;
}
else
{
document.forms['form1'].setAttribute('action','lalala.html?id=1');
document.forms['form1'].submit;
}
}
</script>
|
или так:
<form name=form1 method=post>
...
<input type=button name=but1 onclick=func('lalala.html')>
<input type=button name=but2 onclick=func('lalala.html?id=1')>
</form>
<script>
function func(file_name)
{
document.forms['form1'].setAttribute('action',file_name);
document.forms['form1'].submit;
}
</script>
|
| |
|
|
|