Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
IE issue to run Javascript functions with calculation
Old 11-25-2010, 02:45 PM IE issue to run Javascript functions with calculation
alexsts's Avatar
Novice Talker

Posts: 14
Name: Alex
Location: USA
Trades: 0
Hi guys,
I am new here so please forgive me if my question will sound stupid.
I created simple JavaScript function on the page which perform straight forward calculation and filling out text field on the form.

Code:
 <script language=javascript>
function fillout() 
        {
            var lotnumb = document.getElementById('qtyin').value;
            document.getElementById('qtyhands').value = lotnumb;

        }

 function recalc() 
        {
            
                var win;
                var wout;

                win = document.getElementById('qtyhands').value
                wout = document.getElementById('qtyout').value;
                alert(win);
                alert(wout);
                lotnumb = win - wout;
                alert(lotnumb);
                document.getElementById('qtyhands').value = lotnumb;
            
     }
</script>

<form name=form1>
<tr>      
      <td>
        QTY received
      </td>
      <td>
        <input type=text name="qtyin" id="qtyin" size=50 onchange="fillout();"/>
      </td>      
    </tr>
    <tr>      
      <td>
        Qty sent to production
      </td>
      <td>
        <input type=text name="qtyout" id="qtyout" size="50"  onchange="JavaScript:recalc();" />
      </td>      
    </tr>
    <tr>      
      <td>
        Qty on hands
      </td>
      <td>
        <input type=text name="qtyhands" id="qtyhands" size="50" />
      </td>      
    </tr>

</form>
As you can see nothing fancy, basic JavaScript.
Alerts to see when and what get pass into JS...
It works great in FF and Opera but for some freak-en reason second part( calculation) does not fork in any of versions IE I have.
Any ideas why and how fix this?
Thanks.

Last edited by chrishirst; 11-29-2010 at 04:37 PM.. Reason: missed some details
alexsts is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-25-2010, 03:19 PM Re: IE issue to run Javascript functions with calculation
Mime's Avatar
Extreme Talker

Posts: 164
Name: Seb
Trades: 0
I know semi-colons aren't required by Javascript but because you've used them everywhere else and are missing one here

Quote:
win = document.getElementById('qtyhands').value
IE might be chocking?


That's the only thing I can see at a glance anyway...
Mime is offline
Reply With Quote
View Public Profile
 
Old 11-25-2010, 03:48 PM Re: IE issue to run Javascript functions with calculation
alexsts's Avatar
Novice Talker

Posts: 14
Name: Alex
Location: USA
Trades: 0
Thanks for reply but that is not it.
I put semicolon on place -- still no juice...
alexsts is offline
Reply With Quote
View Public Profile
 
Old 11-25-2010, 08:08 PM Re: IE issue to run Javascript functions with calculation
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
IE doesn't like recalc as a function name (because it's used for a method for document object). Change the name and all will work.
PaulW is online now
Reply With Quote
View Public Profile
 
Old 11-26-2010, 08:12 AM Re: IE issue to run Javascript functions with calculation
alexsts's Avatar
Novice Talker

Posts: 14
Name: Alex
Location: USA
Trades: 0
Worked like a charm.
That is why I always say 2.5 heads better then 0.5...
Thanks.

Last edited by alexsts; 11-27-2010 at 10:48 AM..
alexsts is offline
Reply With Quote
View Public Profile
 
Old 11-29-2010, 04:39 PM Re: IE issue to run Javascript functions with calculation
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
AND use a type="text/javascript" attribute NOT a language attribute.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to IE issue to run Javascript functions with calculation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.00967 seconds with 12 queries