Results 1 to 8 of 8

Thread: Javascript: passing parameters [Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Javascript: passing parameters [Resolved]

    I'm trying to pass a parameter to a function and then having the function output to the textbox that called it.

    Here is my calling function:

    Code:
    echo "<tr><td><p class=other>" . $row[0] . "</td>";
    echo "<td><p class=other><input type=text name=HourEntry" . $i ." size=10 onchange="Changehandler(i)"></td>";
    echo "<td><p class=other4>" . $row2[$i + 3] . "</td>";
    echo "<td><p class=other2><input type=text name=HourEntry2" . $i ." size=10></td></tr>";
    And here is my function:

    Code:
    <script language="JavaScript 1.2" type="text/javascript">
    <!--
    Function ChangeHandler(i)
    {
    	document.dform.HourEntry2.value=(parseFloat(HourEntry" + i + ".value)
    		- parseFloat(HourEntry2" + i + ".value));
    }
    //-->
    </script>
    I'm not sure if the function works, because I can't get the parser to get past the "Changehandler(i)" line when I call it. How do I pass the number of the textbox to the function??

    And in case you need to understand what is going on, the echo lines are in a loop creating approx. 30 text boxes and I need to have the user type text into the first one and have it update the next one.
    Last edited by ober0330; Dec 22nd, 2003 at 10:54 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

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



Click Here to Expand Forum to Full Width