Forum Moderators: open

Message Too Old, No Replies

Confused about the Document Object Model

How do I get one external .js to refer to another?

         

ronin

4:39 am on Dec 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



On a test page I have a drop down form which sends the reader to a new page via an external javascript when the button is clicked.

I want to have the form on multiple pages and I want to be able to add to the list items... but for the sake of maintenance I don't want to have to edit the list on every page, every time it gets longer.

So it makes sense to have the form as an include.

I don't want to use .shtml or ASP or PHP. Don't ask me why - I have an irrational aversion to client side processes.

So I'm happy to have the javascript operated form as an javascript include.

However the javascript engine in Firefox returns the error:

this.form has no properties

presumably because the form is being written into the page from an external .js file using document.write

So... is it possible to have one external javascript working on a form which is included on the page from another external javascript (using document.write)?

Or do I have to go back to the drawing board?

Thanks in advance.

ronin

4:45 am on Dec 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Oh dear.

I'm such a cretin sometimes.

I had just missed out a simple

document.write('<form>');

at the beginning of the script.

That will teach me to drink decaffeinated coffee at 4:45 in the morning.

Thanks for being there, anyway >;->