PDA

View Full Version : form problem


xiaodao
01-03-2005, 12:37 PM
can anybody change the following script to suit for different form according to the id i input in the gosubmit()?

<script language="javascript">
function gosubmit(id,address) {
var id;
document.approvearticle+id.action=address;
document.approvearticle+id.submit();
return true;
}
</script>

Fou-Lu
01-03-2005, 12:45 PM
This is javascript, not php.

xiaodao
01-03-2005, 12:49 PM
yes , i know, but i tried to declare id then put inside the script, cannot work

Fou-Lu
01-03-2005, 12:52 PM
Id needs to be created dynamically, from some kind of input. I don't see where php comes into play at all in this code.
All you need to do to change a javascrip variable is alter whats included when the function is called:
onSubmit = gosubmit(4, none); or something of the sorts. The only time php would possibly come into play is when setting the value provided there for default.

xiaodao
01-03-2005, 01:03 PM
??, i post this topic at javascript forum, why suddenly appear at this forum?