Simple javascript question (I think)

software development

#1

Not real familar with Javascript. But I think this is easy.

Using sortable from Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
but I believe this to be a general Javascript question. Sortable is a table sorting function.

He uses the following line to choose whether to display a webdings font 5 (which is an up arrow) or the unicode equivalent, depending on whether it is IE. At least that’s what I think this line is doing:

sortrevind.innerHTML = stIsIE ? ’ 5’ : ‘&nb__sp;%__B4;’;
(I inserted 2 underscores above so the browser doesn’t render this code. )

where stIsIE is defined as:

var stIsIE = /@cc_on!@/false;

whatever that means.

I believe this is a workaround for IE 6 and 7 since they don’t display this unicode character properly. But the problem is that with IE8 it will display the unicode properly, but it won’t display the webdings properly (it shows it as a “5”). So, I think I need a way to distinguish between IE 8 and earlier versions and then use either webdings or unicode depending.

And basically, I have no idea how to do that or even if that is the right approach. Thus, help requested.

if more code extracts are needed, the whole script is available from his site
http://www.kryogenix.org/code/browser/sorttable/

Thanks,

Mike


#2

IE8 will print webdings no worries at all, it’s probably the code that isn’t picking up that you’re using IE. It’s not clear on the size limitations of the entity you’re trying to print but you might be able to simply change it to something else that does work across everything - like a ^ or something. There are heaps of entities you could substitute tho. For example, a filled delta ▲ is & #9650; and I assume it prints on all browsers (it’s been available for many moons).

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

See MSDN Library - About Conditional Comments

The idea would be to get only previous IE versions to execute JavaScript that assigns a variable. Then modify sorttable.js so that if that variable was assigned you can set stIsIE to true.

Customer since 2000 :cool: openvein.org | Please don’t feed the trolls. :@