...

View Full Version : Easy Javascript parameter problem



steveg
02-14-2007, 04:47 PM
Hi, anyone know why the below script isnt working ?


<SCRIPT LANGUAGE='JavaScript'>
function run_script (script_name)
{
script_name.submit();
}
</SCRIPT>

Thanks

Steve.

nikkiH
02-14-2007, 08:33 PM
Because whatever you're passing to it is not a form, and only form elements have a submit() method?

Do I win? Do I win? :D

steveg
02-15-2007, 09:27 AM
the script_name parameter is the name of a form lower down the page.

i used to use

document.forms[script_name].submit();

instead which works fine on a normal browser but dosent like running under the browser on WindowsCE

also the onClick dosent seem to be working under CE either :(

nikkiH
02-15-2007, 03:14 PM
Did you try passing the form instead?

function run_script (frm)
{
frm.submit();
}

Call like:
<input type="button" ... onclick="run_script(this.form);" ... >

If you still have a hard time getting it to work, please post more code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum