#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Oct 2007
    Posts
    177
    Rep Power
    19

    OnChange / OnBlur Event not working


    Hi,

    I have a matrix of text boxes in a HTML form all have initial values based on an entry from a previous form. If a value is changed in this new form, i want the other values to change also... using the onblur/onchange event.

    I have some sample code, but its not working. Can anyone help ?

    Code:
    <script type="text/javascript">
    function calc(what) {
    var form = document.form1;
    var factor = form.factor.value;
    var factormargin;
    if (what == 0) {
    factormargin = factor / 2;
    form.factormargin.value = factormargin;
    
    } else {
    factormargin = factor / 2;
    form.factormargin.value = factormargin;
    }
    }
    </script>
    
    
    <form id="form1" name="form1" method="post" action="supplier_Added.asp?vpart=<% response.write (vpart)%>">
    
    <input name="factor" type="text" id="factor" value="<% response.write (factorround) %>" onBlur="Calc(this)" />
    
    <input name="factormargin" type="text" id="factormargin" value="<% response.write (factormarginround) %>" />
  2. #2
  3. No Profile Picture
    Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Posts
    1,895
    Rep Power
    310
    Originally Posted by emzipoo4u
    Hi,

    I have a matrix of text boxes in a HTML form all have initial values based on an entry from a previous form. If a value is changed in this new form, i want the other values to change also... using the onblur/onchange event.

    I have some sample code, but its not working. Can anyone help ?

    Code:
    <script type="text/javascript">
    function calc(what) {
    var form = document.form1;
    var factor = form.factor.value;
    var factormargin;
    if (what == 0) {
    factormargin = factor / 2;
    form.factormargin.value = factormargin;
    
    } else {
    factormargin = factor / 2;
    form.factormargin.value = factormargin;
    }
    }
    </script>
    
    
    <form id="form1" name="form1" method="post" action="supplier_Added.asp?vpart=<% response.write (vpart)%>">
    
    <input name="factor" type="text" id="factor" value="<% response.write (factorround) %>" onBlur="Calc(this)" />
    
    <input name="factormargin" type="text" id="factormargin" value="<% response.write (factormarginround) %>" />
    You cannot change the values in another form on another page like this. Is the page with the first form still open in a different window? If not then you will need to use more dynamic code, such as ASP or PHP, or set cookies.

Similar Threads

  1. Onclick event working in IE, not in Mozilla
    By skinnerback in forum HTML, JavaScript And CSS Help
    Replies: 3
    Last Post: September 14th, 2006, 05:53 AM
  2. onchange event firing on server
    By dwright in forum .NET Development
    Replies: 0
    Last Post: July 13th, 2005, 04:38 AM
  3. OnChange event not working on Mozilla Firefox
    By TheRegister in forum Code Bank
    Replies: 1
    Last Post: January 28th, 2005, 09:03 AM
  4. onchange event
    By Steve Schofield in forum SQL Development
    Replies: 0
    Last Post: March 11th, 2002, 07:15 PM
  5. Problems with OnChange() event
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: November 14th, 2001, 02:49 AM

IMN logo majestic logo threadwatch logo seochat tools logo