I know that there is a difference between ff and ie regarding the attribute ‘class’.
I want to put in the global.js something like that:
function GetVarByBrowser()
{
if (navigator.appName == 'Microsoft Internet Explorer')
{
var getClass= 'className';
}
else
{
var getClass= 'class';
}
}
and in the page i added this:
ElementServer.setAttribute(GetVarByBrowser(), 'server');
how can i make it works?
No need for global variables. Have the function return the value instead:
However, this is an imperfect method of browser detection for a number of reasons. Have you considered using a library like jQuery that takes care of quirks like this automatically? Or do you want to learn this yourself (which is perfectly fine and commendable)?