...

View Full Version : Different values in a function



zadjali2000
01-12-2003, 07:47 PM
Hi All,

I'm doing a script to get the values from a radio button and i have a function like this:

function calc(pages, flash, site, host, maint )
{
var t_page = pages
var t_flash = flash
var t_site = site
var t_host = host
var t_maint = maint

}

</script>

and the radio button onClick event is
<input type="radio" value="10" name="number_of_pages" checked onclick="calc (this.value)"> Ofcourse this for pages

now i want to do for the second one(flash) without changing the first one (pages) i tried this but for sure i didn't work

<input type="radio" value="10p" name="number_of_pages" checked onclick="calc ( , ,this.value)"> It does give me syntax errors;

So please can u help me with that :rolleyes:

chrismiceli
01-13-2003, 03:52 AM
try this
<input type="radio" value="10p" name="number_of_pages" checked onclick="calc ( "","" ,this.value)">
that would of course assign the first 2 values (pages and flash) to nothing ("").

zadjali2000
01-13-2003, 03:31 PM
Thanks for ur help but,
what i actualy want is to keep the first two as they are (page, flash) without changing their values at all.

So please can u help again:o

whammy
01-14-2003, 02:28 AM
It seems you're not clear on how variables are passed to a function... here's a simple example:


<script type="text/javascript">
<!--
function blah(one, two) {
alert(one);
alert(two);
}
// -->
</script>

<form id="asdiofj" action="javascript://">
<input type="text" value="lasdkfj" onblur="blah(this.value,'4')" />
</form>


Hope this helps! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum