need help with simple statement

Author Message
edyoung

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 1/13/2011
  • Status: offline
need help with simple statement Thursday, January 13, 2011 7:26 AM (permalink)
0
I put a test alert message in a script...the alert triggers 7 times. The code just looks at 7 user inserted items and adds them together and places the total into a field (I removed the last part for this test).
 
function mistot(){
 var ep = document.forms[0].elements;
 var myamt = 'm-amt';
 var mytot = 0;
for(var i=1; i<=8; ++1) {
 if(isFloat(ep[myamt=i].value)) {
  mytot += +ep[myamt+i].value;
 }
  alert('test');
 }
}
The alert message triggers 7 times because it is inside my "for" statement. However if I place the alert after the for statement...it does not trigger at all. What is wrong with my statment?
 
<snip>----
  mytot += +ep[myamt+i].value;
  }
 }
alert('test');
}
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:need help with simple statement Thursday, January 13, 2011 7:36 AM (permalink)
    0
    Well I would start with the fact that your code is not VBScript.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      edyoung

      • Total Posts : 3
      • Scores: 0
      • Reward points : 0
      • Joined: 1/13/2011
      • Status: offline
      Re:need help with simple statement Thursday, January 13, 2011 8:03 AM (permalink)
      0
      oops...
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9