I continue to get, function not defined when calling the function build_blog() through the function start()?


<script type="text/javascript">

var SEO;
var conversion;
var SMO;

function Start()
    document.write("Blog Name: <input type='text' id='name'><br> Blog System: <input type='radio' name='system' id='system' value='blogger'> Blogger<input name='system' type='radio' id='system' value='Wordpress'>Wordpress<br><input type='button' value='Build My Blog' onClick='Build_Blog();'>");

function Build_Blog()

<p>Welcome Website Creator! Website Creator gives you a realistic feel of what it is like to run a website or blog. Advertise, Rank, and Blog with Website Creator. Click Start to begin!</p>
<input type="button" value="START" onclick="Start();">
7 Years
Discussion Span
Last Post by Airshow


Used that way, document.write will blitz the entire document. Thereafter Build_Blog no longer exists.

document.write is generally only used in inline scripts embedded in the HTML, or to write the contents of a child window or iframe.



Is there an alternative to document.write then?


Yes. there are many approaches, most of which fall into one or other of the following categories:

  • Hard-code the required HTML on the page, initially hidden, then show it using javascript during the life of the page.
  • Dynamically create document nodes (DOM scripting) using javascript during the life of the page.

The first approach is by far the easier.

A hybrid approach is also common, in which HTML container(s) are hard-coded on the page, and content is inserted into them during the life of the page.

I'm on my netbook right now so won't attempt any code but please ask - I will be on my desktop computer some time later today/tomorrow.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.