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

<html>
<head>
<style>



</style>
<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()
{
alert("d");
}

</script>
</head>
<body>
<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();">
</html>

Joe,

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.

Airshow

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.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.