p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Problem with client side script (http://p2p.wrox.com/showthread.php?t=29436)

cschng May 17th, 2005 11:14 PM

Problem with client side script
 
i am now doing the asp.net with javascript as client side script.
i have a script as below
<script language="javascript">
function recalStkBal(){
txtStkBal.value=parseFloat(txtOpenbal.value)-parseFloat(txtStkDed.value)
}
</script>

 and with the web control

<asp:textbox name="txtOpenBal">....
<asp:textbox name="txtStkDed">....
<asp:textbox name="txtStkBal">....

 and with code behind

private sub page_load(....)..
txtOpenBal.attribute.add("onBlur","recalStkBal()")

so what i expect is when the user lost focus from the txtOpenBal the "recalStkBal()" should raise and reset the txtStkBal.value to the new value.but i cannot get it so can or any one can help me up? thanks in advance.......


but i do test this code in html page, it seem working well.i try it by run the .aspx page then right click and view code then save as the code as .html it seem working.cause aspx page will render as plain html as run at the server then i test over this code should get the same result right?

parithi May 23rd, 2005 12:33 AM

1 first you know one thing,html control and server control is different,using server control to specfic runat="server" inside of tag.
2.inside script block to access the server control using two ways
  a.document.(form name).elements.txtcount.value
  b. document.all.item("control name").value
     example
using script side
function recalStkBal()
{
    document.all.item("txtStkBal").value=parseFloat(do cument.all.item("txtOpenbal").value)-parseFloat(document.all.item("txtStkDed").value);}
with in code behid using this code
private void Page_Load(object sender, System.EventArgs e)
        {

            txtOpenBal.Attributes.Add("onblur","recalStkBal()" )

        }


parithi May 23rd, 2005 12:43 AM

//*This coding developed C.Elamaprithi M.C.A..*\//Mail;parithi_kum@yahoo.co.in,parithi4u@hotmail.com \--------------------------------------------------------
1 first you know one thing,html control and server control is different,using server control to specfic runat="server" inside of tag.
2.inside script block to access the server control using two ways
  a.document.(form name).elements.txtcount.value
  b. document.all.item("control name").value
     example
using script side
function recalStkBal()
{
    document.all.item("txtStkBal").value=parseFloat(do cument.all.item("txtOpenbal").value)-parseFloat(document.all.item("txtStkDed").value);}
with in code behid using this code
private void Page_Load(object sender, System.EventArgs e)
        {

            txtOpenBal.Attributes.Add("onblur","recalStkBal()" )

        }



All times are GMT -4. The time now is 05:50 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.