Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

onActivate() called twice when document.write is called in
Javascript

Robert Vojta

2008-11-05

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi all,

onActivate() is called twice on my page when I have following Javascript
code included. When I remove document.write() call, onActivate() is called
once. Any idea how can I solve this?

Sample.tml

...
<head>
<script type="text/javascript"
src="${asset:context:/js/styleloader.js}"></script>
...

styleloader.js

function loadBrowserStyle()
{
 ... handling routines, where specialCSS is filled with proper style
(different style for different browsers)
  document.open();
  document.write("<link rel=stylesheet type='text/css'
href='"+specialCSS+"' title='externe Styles'>");
  document.close();
}
loadBrowserStyle();

onActivate() is called twice even if I replace <link rel=... in
styleloader.js with something like this ...

"<link href=\"${asset:context:" + specialCSS + "}\" rel=\"stylesheet\"
type=\"text/css\" />"

Any idea how can I write to page from Javascript without calling
onActivate() twice?

Regards,
Robert
--
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.