Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-01-28 13:36:32

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Can Xinha Co-exist With Another Onload Command?

I see that Xinha normally launches using an HTML onload command:

 window.onload   = xinha_init;

I'm trying to get Xinha to work with an HTML page that uses the onload command in the body tag:

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

It looks like the onload command in the body tag is replacing the one Xinha is using, and preventing it from launching Xinha.

Is there a way to modify the command used to launch Xinha, so that Xinha still launches, even if the body tag of the HTML page uses the onload command?

Offline

#2 2006-01-30 06:54:19

rbw
New member
Registered: 2006-01-27
Posts: 6

Re: Can Xinha Co-exist With Another Onload Command?

Two ways (maybe there are more, better ones, but these are the first that came into my head smile ):

1.
Delete line:
 

window.onload   = xinha_init;

and change line:
 

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

to
 

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

2.
Change line:
 

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

to
 

<body>

and instead of
 

window.onload = xinha_init;

put
 

    function loader(){
      document.forms[0].title.focus();
      xinha_init();
    }
    window.onload = loader;

Now put into the function loader whatever you need to do on page load. This way is better because it makes <body> section cleaner and as it was said somewhere in these forums, window.onload is better than <body onload=""> smile
Cheers

Offline

#3 2006-01-30 17:23:37

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Re: Can Xinha Co-exist With Another Onload Command?

Thanks RBW. This is very helpful.

Offline

#4 2006-01-31 03:59:52

rbw
New member
Registered: 2006-01-27
Posts: 6

Re: Can Xinha Co-exist With Another Onload Command?

Vik wrote:

Thanks RBW. This is very helpful.

No problem. Started 'playing' with Xinha couple days ago, trying to adapt it to CMS. So there's no problem about sharing things that I learned smile

Offline

Board footer

Powered by FluxBB