# Question on using javascript

**URL:** <https://boards.straightdope.com/t/question-on-using-javascript/628575>\
**Category:** Factual Questions\
**Created:** [July 18, 2012, 12:34am UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575 "2012-07-18T00:34:34Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)\
**Post date:** [July 18, 2012, 10:29pm UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575/21 "2012-07-18T22:29:48Z")

</div>

The problem was my HTML header. Used an updated one and everything works great.

OK another question. I have the HTML code for my pulldown menu (suckerfish of course). I don’t want to put the entire table into every page. Is that where PHP comes in where I would put the table in a script and run that script every page?

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [July 19, 2012, 12:40am UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575/22 "2012-07-19T00:40:31Z")

</div>

You would write the html in one file and then include it on every page where you want it to appear.

> **[PHP include and require](https://www.w3schools.com/php/php_includes.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [July 19, 2012, 12:55am UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575/23 "2012-07-19T00:55:13Z")

</div>

Well, why don’t you want the whole table in every page? Did you mean you want a selective portion of it in each one?

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [July 19, 2012, 1:57am UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575/24 "2012-07-19T01:57:40Z")

</div>

> [@TriPolar](#):
>
> Well, why don’t you want the whole table in every page? Did you mean you want a selective portion of it in each one?

I assume s/he means that s/he doesn’t want to paste the code in every page to render the table on each page, which nobody wants to do, which is why God gave us server-side includes.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [July 19, 2012, 2:14am UTC](https://boards.straightdope.com/t/question-on-using-javascript/628575/25 "2012-07-19T02:14:57Z")

</div>

> [@ZipperJJ](#):
>
> I assume s/he means that s/he doesn’t want to paste the code in every page to render the table on each page, which nobody wants to do, which is why God gave us server-side includes.

Yeah maybe. The wording sounded like there might be customization of the table involved. But all those things should be handled on the server side.

[Previous page](https://boards.straightdope.com/t/question-on-using-javascript/628575.md?page=1)
