Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Browser compatibility

Reply
Thread Tools

Browser compatibility

 
 
jfancy-Transport Canada
Guest
Posts: n/a
 
      05-26-2005
I need this translated so it can be used in Mozilla, and in Opera. Two
seperate ways of code is fine. Thanks!

Justin

-------------------------------------------------------------------

<html>
<head>

</head>
<body>
<h1>Hello there</h1>
<h2>Test</h2>
anything.

<input type="button" onclick="resizeBodyText(2, 'n')" value="Font +" >
<input type="button" onclick="resizeBodyText(-2, 'n')" value="Font -" >

<input type="reset" onclick= "resizeBodyText(0, 'y')">

<script type="text/javascript">
//-------------------------------------------------


var current = parseInt(getCookie("fontFactor"))
if (isNaN(current))
current= 0;

resizeBodyText(current, "n")
function resizeBodyText(factor, reset)
{
if (reset=="y")
factor= (current * -1);

window.alert(current + " " + factor)
//------------------------------------------------
var a = document.all;
var s = '';
current += factor;

if (current < 0)
current = 0;
else
for (var i = a.length-1; i >0;i--)
{
s=a[i].currentStyle.fontSize+'';
s=Right(s,2);
a[i].style.fontSize = parseInt(a[i].currentStyle.fontSize)+factor+s;
}
setCookie("fontFactor", current)
}

//-----------------------------------------------
function Right(str, n) {
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else {
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
//-------------------------------------------------
function getCookie(name) {
var dc = document.cookie;
var index = dc.indexOf(name + "=");
if (index == -1) return null;
index = dc.indexOf("=", index) + 1; // first character
var endstr = dc.indexOf(";", index);
if (endstr == -1) endstr = dc.length; // last character
return unescape(dc.substring(index, endstr));
}
function setCookie(name, value)
{
document.cookie= name + "=" + escape(value);
}

</script>
</body>
</html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid with scrollbar browser compatibility problem Goffin ASP .Net 2 08-05-2005 09:58 AM
Formatting and browser compatibility Paul Mason ASP .Net 2 05-20-2005 08:19 AM
How far does ASP.NET keep up with its Browser Compatibility? ms ASP .Net 3 02-02-2005 09:36 AM
Browser Compatibility Issues =?Utf-8?B?RzI=?= ASP .Net 2 05-17-2004 04:39 AM
Re: Non IE browser compatibility. Peter Blum ASP .Net 2 02-16-2004 01:04 PM



Advertisments