there is an error somewhere in my code, but i cant work it out.
could one of you give it a quiq look?

<html>
<head>

<script language="JavaScript">
function bereken()
{
    j = parseInt(fx.s.value)
    p = parseInt(fx.j.value)
    s = parseInt(fx.p.value)
    while (j > 0 ) 
    {
        j = j-1
        r = (p\100)*s
        s = s+r
        ns = s
    }

    {
    document.write ("nieuwsaldo ",ns,")
    }
    window.alert ("uw nieuwe salso is"+nieuwsaldo+" euro.")
    }



</script>
</head>

<body>
<form name="fx" method="post">
<pre>
huidig saldo:        <input name="s" type="text"> 
jaren:           <input name="j" type="text"> 
rente percentage:    <input name="p" type="text">
<input type="button" name="bereken" value="Bereken" onClick="bereken()">
<pre>
</form>

</body>
</html>

Recommended Answers

All 6 Replies

Hi and welcome! Please use code tags. Generally, javascript lines end with a semicolon ( ; ), but that's not the problem now. Division is done with a forward slash ( / ) - line 13. Also, there's something wrong with your document.write. What do you want to write? And in your alert you mean ns, I guess?

i removed the write (din't need it)
and chanced the \ into / and changed "+nieuwsaldo+" into "+ns+" but i still have't got it working.
i suspect it has got something to do with my parseInt lines

Did you change nieuwsaldo to ns? Could you post your new code in code tags? Furthermore, if you run your code in chrome or in firefox with firebug, you can view the errors your code gives.

how do i add code tags?

Put it between and [/code ].[code ] and [/code ].

i have got it!
thanks for the fire bug tip!
the prblem was at the Fuction.

thank U!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.