Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, July 09, 2013

selectivizr


selectivizr is a handy javascript file that allows you to use CSS3 pseudo-classes and not have to worry about the annoying browser that is known as IE.  It works with a number of js libraries and once you add it to your head then you won't need to do any more.

selectivizr

Wednesday, June 01, 2011

Javascript Subtraction without the extra decimals

I needed to do a simple javascript subtraction but forgot about the floating point. This puts a 1 "x" decimal places to the right of the decimal point. This is because computers work in binary rather than numbers.

To get around this I used the JavaScript round() Method and the code can be shown below:

<script language="Javascript" type="text/javascript">
<!--
var value1 = 25.00;
var value2 = 23.98;
var result = (value1 - value2) * 100;
var Myresult = Math.round(result) / 100;
document.write("My result is " + Myresult + " and no weird decimals");
//-->
</script>