Monday, August 15, 2011

Pass TextBox ID to javascript function


TextBox2.Attributes.Add("onkeyup", "Fill('" + TextBox1.ClientID.ToString() + "','" + TextBox2.ClientID.ToString() + "','" + TextBox3.ClientID.ToString() + "')")
 

<script type="text/javascript">
    function Fill(x, y, z) 
    {
            val1 = parseFloat(document.getElementById(x).value);
            val2 = parseFloat(document.getElementById(y).value);   
//code here         
    }
    </script>
 

No comments:

Post a Comment

I Built a New Kind of Number Puzzle Game (And You Can Play It Free)

 For a long time, I wanted to play a mobile puzzle game that felt genuinely strategic—something that required real brainpower, skipped the a...