Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Gulf
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Different values in a function

    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
    =======================
    =======================
    WebMaster
    =======================
    =======================

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ("").

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    Gulf
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not what i want

    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
    =======================
    =======================
    WebMaster
    =======================
    =======================

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It seems you're not clear on how variables are passed to a function... here's a simple example:
    Code:
    <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!
    Last edited by whammy; 01-14-2003 at 01:30 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •