Thread: Cookies...
View Single Post
Old 11-05-2004, 09:24 AM   #1 (permalink)
buchannon
Registered User
 
buchannon's Avatar
 
Join Date: Nov 2004
Posts: 43
buchannon is on a distinguished road
Cookies...

Ok I had a post in here about changing the font size of a document, and I finally got it working, now I'm trying to store and unload that value into a cookie for when the user comes back it will remain the same size font. I'm totally new to all this so whatever help you guys can give me would help. So far I have:

Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Test</title>
<script type="text/javascript">

function changeSize(size)
{
var date = new Date("December 31, 2023");
var the_date = date.toGMTString();
var the_size = "sizecookie=" + size +";expires=" + the_date;
document.cookie = the_size;
//cookie saved as sizecookie=xxpx;expires=December 31, 2023

//Starts unloading cookie
var csize = document.cookie;
var csize = csize.split("=");
var csize = csize[1];
var csize = csize.split(";");
var csize = csize[0];

document.getElementById('test').style.fontSize = csize;
document.getElementById('tabletest').style.fontSiz e = csize;
}//changeSize


</script>
</head>

<body>
<form>
<select title="Select a Font Size" name="FontSize" id="FontSize" style="width:75px" class="layoutMenu">
<option value="10px">10px</option>
<option value="11px">11px</option>
<option value="12px" selected>12px</option>
<option value="13px">13px</option>
<option value="14px">14px</option>
<option value="15px">15px</option>
<option value="16px">16px</option>
<option value="17px">17px</option>
<option value="18px">18px</option>
<option value="19px">19px</option>
<option value="xx-large">extra Large</option>-->
</select>

<input type="button" onclick="changeSize(document.getElementById('FontS ize').value);" value="GO TO IT!">
</form>

<div id="test">
Here is some text
<br>

<br>
Here is some text


<table id="tabletest"><tr><td>did it work on me?</td></tr><tr><td>How about me?</td></tr></table>


</div>

</body>
</html>
buchannon is offline   Reply With Quote