By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

Alternative to Using Onload Command?

P: n/a
I'm working on integrating the a javascript wysiwyg editor (Xinha) with
my blog software (ExpressionEngine, aka EE). EE has extensions now so
it's easy to get the Xinha header code into the head section of the EE
web page.

But Xinha likes to use an onload command to launch:

window.onload = xinha_init;

....and EE is already using the onload command in the body tag of the web
page:

<body onLoad="document.forms[0].title.focus();set_catlink();" >

The onload command in the body tag is keeping the window.onload command
from working. At this point EE doesn't let extensions modify the body
tag.

Is there an alternative way to run the xinha_init command, without using
the window.onload command? Thanks very much to all for any info.
Jan 28 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Vik Rubenfeld wrote on 28 jan 2006 in comp.lang.javascript:
The onload command in the body tag is keeping the window.onload command
from working. At this point EE doesn't let extensions modify the body
tag.


=================================
<body onload='alert(2);'>

<script type="text/javascript">
x = document.body.outerHTML.split('>')[0].split('=')[1]
window.onload = function(){alert(1);eval(x)}
alert(0);
</script>
=================================

returns alerts: 0 1 2

sorry for the evil eval() and outerHTML is IE only.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 28 '06 #2

P: n/a
On 2006-01-28, Evertjan. <ex**************@interxnl.net> wrote:
Vik Rubenfeld wrote on 28 jan 2006 in comp.lang.javascript:
The onload command in the body tag is keeping the window.onload command
from working. At this point EE doesn't let extensions modify the body
tag.


=================================
<body onload='alert(2);'>

<script type="text/javascript">
x = document.body.outerHTML.split('>')[0].split('=')[1]
window.onload = function(){alert(1);eval(x)}
alert(0);
</script>
=================================

returns alerts: 0 1 2

sorry for the evil eval() and outerHTML is IE only.


<body onload='alert(2);'>

<script type="text/javascript">
x = window.onload;
window.onload = function(){alert(1);x();}
alert(0);
</script>

works in mozilla
but if you know that the onload function will always be the same (and won't
be anonymous) you can just call it by name.

--

Bye.
Jasen
Jan 29 '06 #3

P: n/a
Jasen Betts wrote on 29 jan 2006 in comp.lang.javascript:
<body onload='alert(2);'>

<script type="text/javascript">
x = window.onload;
Nice!! Test this here:

alert(x)

window.onload = function(){alert(1);x();}
alert(0);
</script>

works in mozilla


Also in ie6

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.