asp.net javascript masterpage

Last post 05-14-2009 12:58 AM by kaushalparik. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-12-2009 1:34 PM

    • janetb
    • Not Ranked
    • Joined on 05-12-2009
    • Wannabe Slacker
    • Points 8

    asp.net javascript masterpage

     I'm not a Javascript person, so please be kind.  I've got an asp.net 2 page that has a master page.  I've got a javascript that works fine in a regular asp.net page within the same web.  Move it to the page with the master page, and it won't work.  Any help appreciated.  Also, what's the difference between function setDifference(form) and setDifference = function(form)?  Here's the basic stuff: 

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <script>
    setDifference = function(form)
    {
    var x = document.getElementById('dtTxt1').value;
    var y = document.getElementById('dtTxt2').value;
    var dt1 = Date.parse(x)
    var dt2 = Date.parse(y)
    document.getElementById(
    'resultTxt').value = (dt1.valueOf() - dt2.valueOf()) / (60 * 60 * 24 * 1000)
    }
    </script>

     

     

    <asp:TextBox ID="dtTxt1" name="dtTxt1" runat="server" onkeyup="BLOCKED SCRIPTsetDifference(this.form);" onkeydown="BLOCKED SCRIPTsetDifference(this.form);" /><br />
    <asp:TextBox name="dtTxt2" id="dtTxt2" runat="server" onkeyup="BLOCKED SCRIPTsetDifference(this.form);" onkeydown="BLOCKED SCRIPTsetDifference(this.form);" />
    <br /><asp:textbox name="resultTxt" id="resultTxt" runat="server" /><br /><br />

  •  Advertisement

    Featured Advertisement

     
  • 05-14-2009 12:58 AM In reply to

    Re: asp.net javascript masterpage

    i tried the javascript with minor changes like removing our "BLOCKED SCRIPT" and replacing code like var x = document.getElementById('dtTxt1').value; with

    var x = document.getElementById('<%=dtTxt1.ClientID%>').value; and it worked for me..

     

     

    janetb:
    Also, what's the difference between function setDifference(form) and setDifference = function(form)?

    check out this link: BLOCKED SCRIPT var functionName = function() {} vs function functionName() {}

    hope it helps./.

    "I would love to change the world, but they won’t give me the source code"

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point & mark your thread as Resolved for the sake of Future Readers.

    KaushaL || BLOG || Profile || Microsoft MVP
Page 1 of 1 (2 items)