Question: I'm a "long time reader first time poster", glad to start participating in this forum.

My experience is with Java, Python, and several audio programming languages; I'm quite new to the big bad web technologies: HTML/CSS/JavaScript. I'm making two personal sites right now and am wondering if I'm relying on JavaScript too much.

I'm making a site where all pages have a bit of markup in common--stuff like the nav bar and some sliced background images--so I thought I'd make a pageInit() function to insert the majority of the HTML for me. This way if I make a change later, I just change the script rather than all the pages. I figure if users are paranoid enough to have JavaScript turned off, I'll give them an alert or something. Is this bad practice? Can JavaScript be overused?

Thanks in advance.

Answer: 
Putting HTML in your JavaScript is a bad idea. If you want to keep common HTML together, there are many different templating solutions out there for many different server side languages.

The simplest way to get started is to use php includes or jsp includes. 

**PHP**:

```
    <html>
     <body>
       <?php include("header.php"); ?>
       <h1>Welcome to my home page!</h1>
       <p>Some text.</p>
     </body>
    </html> 

```

**Java/JSP**:

```
    <html>
     <body>
       <%@include file="header.jsp" %>
       <h1>Welcome to my home page!</h1>
       <p>Some text.</p>
     </body>
    </html> 

```
If your javascript adds to the user experience then no. The web is moving forward and javascript is a technology that is significantly enhancing the user experience and turning the internet into a rich source of content and applications. It shouldn't be considered bad.

Ideally your site should work without javascript but as long as you are alerting your users to the fact that your site requires it then that's something at least.

If you're interested there is currently a free ebook by Jesse Skinner on Unobtrusive Ajax which talks about enhancing the user experience using ajax but without restricting those users who have javascript switched off. It's a good read.

[Unobtrusive Ajax - Jesse Skinner](http://books.google.co.uk/books?id=ZrujFvxg-CUC&printsec=frontcover&dq=unobtrusive+ajax&source=bl&ots=5f62UdyFA3&sig=rCGDo_oEXvZlIHy20rvNk6Hjk_8&hl=en&ei=LusoTYrvBYfOhAfbw5nrDQ&sa=X&oi=book_result&ct=result&resnum=3&ved=0CCsQ6AEwAg#v=onepage&q&f=false)