cricketeer1
IS-IT--Management
Hi all,
This is a strange problem. I support an application that implements JavaScript functions by using VBScript code (don't ask me why). So, for example, a currency to number conversion in Javascript is ultimately using Ccur VBScript function. What has started happening recently is that for some fractions a currency datatype value returned from VBScript is showing extra zeros in Javascript.
One of our developers wrote the following sample code to highlight the issue:
<html>
<body>
<script type="text/vbscript">
function test()
Dim randomNumber
randomNumber=0
randomNumber=cCur(box.value)
box2.value=randomNumber
test=randomNumber
end function
</script>
<script type="text/javascript">
function check()
{ var num;
num= test();
box1.value=num;
}
</script>
Input: <input type="text" value=" " id="box"></input>
<br>
Java script: <input type="text" value=" " id="box1"></input>
<br>
Vb script: <input type="text" value=" " id="box2"></input>
<br>
<br>
<input type="button" value="Run scripts" onClick="check()"></input>
</body>
</html>
If I run this script on my machine in IE 6 for an input like 132.2 I get Javascript: 132.20000000000002 and VBScript:132.2
I can get the proper value to display by changing the line randomNumber=cCur(box.value) to randomNumber=CDbl(cCur(box.value)).
The question is why is this happening now ? Most of the users of this application have been using IE 6 for years and never reported this problem. There is a strong feeling in my team that the problem has to do with some MS security update, but I have not found any reference to such a problem anywhere on the web.
Has anyone come across this sort of a problem?
This is a strange problem. I support an application that implements JavaScript functions by using VBScript code (don't ask me why). So, for example, a currency to number conversion in Javascript is ultimately using Ccur VBScript function. What has started happening recently is that for some fractions a currency datatype value returned from VBScript is showing extra zeros in Javascript.
One of our developers wrote the following sample code to highlight the issue:
<html>
<body>
<script type="text/vbscript">
function test()
Dim randomNumber
randomNumber=0
randomNumber=cCur(box.value)
box2.value=randomNumber
test=randomNumber
end function
</script>
<script type="text/javascript">
function check()
{ var num;
num= test();
box1.value=num;
}
</script>
Input: <input type="text" value=" " id="box"></input>
<br>
Java script: <input type="text" value=" " id="box1"></input>
<br>
Vb script: <input type="text" value=" " id="box2"></input>
<br>
<br>
<input type="button" value="Run scripts" onClick="check()"></input>
</body>
</html>
If I run this script on my machine in IE 6 for an input like 132.2 I get Javascript: 132.20000000000002 and VBScript:132.2
I can get the proper value to display by changing the line randomNumber=cCur(box.value) to randomNumber=CDbl(cCur(box.value)).
The question is why is this happening now ? Most of the users of this application have been using IE 6 for years and never reported this problem. There is a strong feeling in my team that the problem has to do with some MS security update, but I have not found any reference to such a problem anywhere on the web.
Has anyone come across this sort of a problem?