views:

168

answers:

2

Does anybody know if there is a length limitation for the onclick attribute in IE7? It seems that my onclick value is cut off after 259 chars.

EDIT: Thanks for all your answers. It seems there is not limitation for the onclick attribute. There must be a bug somewhere in my code.

+1  A: 

Must be a typo in your value (e.g. unmatched quotes)...

this works fine for me... (1,537 chars)

<div onclick="alert('asdf asdf erg dfa wefe rg sdgs df asrg asd gf ser gfs df gr ser gfaer gfas df as rg segf s werf  dfg as er f er gfse rgf a wdf  ergf se rgfa sdfa ser f asew rf aw ef awe f e sr gfa we f a ergf a werf aswerf aw ef e r gfsergf ser g er g se rf ser fse rgh se rg s er fs er g e g se rg s er g s er fg sd  gf sdr gs r es r gfsd fg s er g ser g se g d fg sd f gs df gsdfgsdfgsdfgsdfgsdf gsdf gsdfgsdfgs dfgsdfgsdf gs df gsdfgsdfgsdfgsdf ger gfas df as rg segf s werf  dfg as er f er gfse rgf a wdf  ergf se rgfa sdfa ser f asew rf aw ef awe f e sr gfa we f a ergf a werf aswerf aw ef e r gfsergf ser g er g se rf ser fse rgh se rg s er fs er g e g se rg s er g s er fg sd  gf sdr gs r es r gfsd fg s er g ser g se g d fg sd f gs df gsdfgsdfgsdfgsdfgsdf gsdf gsdfgsdfgs dfgsdfgsdf gs df gsdfgsdfgsdfgsdf ger gfas df as rg segf s werf  dfg as er f er gfse rgf a wdf  ergf se rgfa sdfa ser f asew rf aw ef awe f e sr gfa we f a ergf a werf aswerf aw ef e r gfsergf ser g er g se rf ser fse rgh se rg s er fs er g e g se rg s er g s er fg sd  gf sdr gs r es r gfsd fg s er g ser g se g d fg sd f gs df gsdfgsdfgsdfgsdfgsdf gsdf gsdfgsdfgs dfgsdfgsdf gs df gsdfgsdfgsdfgsdf gs df as rg segf s werf  dfg as er f er gfse rgf a wdf  ergf se rgfa sdfa ser f asew rf aw ef awe f e sr gfa we f a ergf a werf aswerf aw ef e r gfsergf ser g er g se rf ser fse rgh se rg s er fs er g e g se rg s er g s er fg sd  gf sdr gs r es r gfsd fg s er g ser g se g d fg sd f gs df gsdfgsdfgsdfgsdfgsdf gsdf gsdfgsdfgs dfgsdfgsdf gs df gsdfgsdfgsdfgsdf g END END END');">Hello</div>
scunliffe
+1  A: 

There is no length limit on these attributes. More likely you are accidentally using a quote inside the attribute to make the whole tag un-parsable as in:

<input type="button" onclick="alert("I'm not quite right.");"/>

You can fix this in two ways:

<input type="button" onclick="alert('I\'m all better now.');"/>
<input type="button" onclick="alert(&quot;I'm all better now.&quot;);"/>
dlamblin