Can't get syntax correct for dynam. create onclick the ie way.

Posted by Max on Stack Overflow See other posts from Stack Overflow or by Max
Published on 2010-04-26T10:54:52Z Indexed on 2010/04/26 11:23 UTC
Read the original article Hit count: 164

I was hoping to keep cross-browser compatibility and afaik this is the only issue so far.

.setAttribute("onclick", "return showRapidText("+itemnum+");"); 

This works PERFECT but I'd like to make it IE compatible by putting it in this syntax

.onclick = new Function("fnDisplay_Computers('" + alines[i] + "')");

so... I tried

.onclick = new Function("showRapidText('" + itemnum + "')");

and

.onclick = new Function("return showRapidText('" + itemnum + "')");

and about 40 other ways but nothing works

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dynamic