Hi Everybody!! CowGirl is here!!
I was able to come up with a script that lets visitors to my website click on a button and increase/decrease/reset the font size. The only problem is that when they go to another page of my website, the font size reverts to the default setting, meaning that they visitor must again manually increase/decrease the font size. Clearly, this is inconvenient to the visitor. Thus, I would like each page to retain the increased/decreased font size of the previous page. I understand that the best way to do this is to use a cookie to save the user’s selected font size when the font is changed by the user (increased, decreased, reset). Then every time a page on my site loads, check if the user has that cookie. If so, retrieve the cookie’s value and set the font size to the font in the cookie.
Problem is I am not an expert in cookies. I was using the increase/decrease/reset font size javascript function of [URL=”http://www.discoveryeye.org/”]http://www.discoveryeye.org/[URL=”http://www.discoveryeye.org/”]http://www.discoveryeye.org/[URL=”http://www.discoveryeye.org/”]http://www.discoveryeye.org/
My website is not done, but I published a few pages with the adjust font size javascript at [URL=”http://www.14kt.eu/”]http://www.14kt.eu/
SCRIPT (BEGIN)
function changeFontSize(objId, doIncreaseSize) {
var currentSize = 0, obj = document.getElementById(objId), newVal = 0, limitMax = 1.7, limitMin = 0.9, unit = 0.1;
if(!obj){
return false;
}
currentSize = parseFloat( obj.style.fontSize );
if (!obj.originalSize) { obj.originalSize = currentSize; }
if(doIncreaseSize){
unit = -unit;
}
newVal = currentSize – unit;
if(limitMax >= newVal && limitMin <= newVal){
obj.style.fontSize = newVal + “em”;
}
return true;
}
function resetDefaultSize(objId) {
var obj = document.getElementById(objId);
if(!obj){
return false;
}
if (obj.originalSize) { obj.style.fontSize = obj.originalSize + “em”; }
return true;
}
SCRIPT (END)
HTML (BEGIN)
INCREASE: <href=”#” onclick=”changeFontSize(‘mydiv’, true); return false;”>
DECREASE: href=”#” onclick=”changeFontSize(‘mydiv’); return false;”>
RESET TO DEFAULT: <href=”#” onclick=”resetDefaultSize(‘mydiv’); return false;”>
HTML (END)
Thank you for your time, CowGirl!!!!!!!!!!!