J
jan
My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.
I have a website with more than 1000 pages. I've built a form into
every page that links to a couple hundred major cities. It looks like
this:
<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document.majoruscities.select.value;">
<option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
..
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>
It works real good, and when I use website software it is easy to make
a change and have it appear throughout a web site.
However, this is a situation in which I am writing much of the html and
js manually. My methods seem very wasteful.
Instead of having the entire form be part of every html page I want to
call most of it seperately, from one source file. That way, if I want
to add, change, or remove a link from the form, I don't have to
regenerate every page. Also, it won't take up unnecessary space, and
won't have unnecessary upload times when I change them.
I imagine the easiest way would take a format something like what is
used to get an image source?????
<img src="../images/picture.jpeg">
Of all the solutions that work, which is preferred? Link to a good
example?
Thanks,
Jan
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.
I have a website with more than 1000 pages. I've built a form into
every page that links to a couple hundred major cities. It looks like
this:
<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document.majoruscities.select.value;">
<option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
..
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>
It works real good, and when I use website software it is easy to make
a change and have it appear throughout a web site.
However, this is a situation in which I am writing much of the html and
js manually. My methods seem very wasteful.
Instead of having the entire form be part of every html page I want to
call most of it seperately, from one source file. That way, if I want
to add, change, or remove a link from the form, I don't have to
regenerate every page. Also, it won't take up unnecessary space, and
won't have unnecessary upload times when I change them.
I imagine the easiest way would take a format something like what is
used to get an image source?????
<img src="../images/picture.jpeg">
Of all the solutions that work, which is preferred? Link to a good
example?
Thanks,
Jan