Please use the forum's bbcode tags to make it more readable:
for php code............[php] <?php /* code goes here */ ?> [/php]
for html...............[html] <!-- markup goes here -->.....[/html]
for js/css/other.......[code] code goes here................[/code]
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calc</title>
<script type="text/javascript">
function setCookie(c_name,value,exdays) {
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
document.getElementById("answer").value = unescape(y);
}
}
}
function calculate() {
var one = document.getElementById("one").value*1;
var two = document.getElementById("two").value*1;
var three = document.getElementById("three").value*1;
document.getElementById("answer").value=((one-two)/three).toFixed(2);
setCookie('remCalc',((one-two)/three).toFixed(2),'100');
}
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
</script>
</head>
<body onload="getCookie('remCalc')">
Enter Friend Score
<br>
<br><input type="text" id="one" /><hr>Enter Your Score<br><br><input type="text" id="two" /><br><br><hr>Enter Your Average Score<br><br><input type="text" id="three" /><br><br><button onclick="calculate();">Calculate</button> <br id="result"></center></br> Total <input type="text" readonly="readonly" id="answer" /><br><br></center>
</body>
</html>
From here
Tested in IE9 - Make sure you have cookies enabled...
Edit: Also, please don't post multiple copies of your question cerrup.
Bookmarks