Back in this thread, I posted a generator that made something you put in. I tried adding another generator to the same page the other is on on my site, but it doesn't work.
For example, here's what I have:
Code:
<fieldset>
<a name="hsggenerator"></a>
<h1>HSG</h1>
<em>Head Section Generator</em>
<script type="text/javascript">
/***********************************************
* Javascript Generator Script by PGReviews (Physicsguy's Reviews)
* Visit http://www.execulink.com/~kayes/physicsguy/web/ for reviews, guitar tablature, and more!
* This notice must stay intact for legal use
***********************************************/
function welcome()
{
document.write("<fieldset><b>HSG output:</b> <br><hr><br> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" <br> \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"> <br> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\"> <br> <head> <br> <title>" + document.forms["generatorform"]["nameofsite"].value + "</title> <br> <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" /> <br> <meta name=\"author\" content=\"" + document.forms["generatorform"]["nameofauthor"].value + "\" /> <br> <meta name=\"description\" content=\"" + document.forms["generatorform"]["descriptionofsite"].value + "\" /> <br> <meta name=\"keywords\" content=\"" + document.forms["generatorform"]["keywords"].value + "\" /> <br> <link rel=\"stylesheet\" href=\"" + document.forms["generatorform"]["stylesheet"].value + "\" type=\"text/css\" media=\"screen\" /> <br> <link rel=\"shortcut icon\" href=\"images/favicon.ico\" type=\"image/x-icon\"> <br> </head> <br><br><hr></fieldset>");
}
</script>
<p>Enter the name of your site:</p>
<form name="generatorform" action="generator.htm" onSubmit="welcome()">
<input type="text" name="nameofsite" size="20">
<br>
<p>Enter your name:</p>
<input type="text" name="nameofauthor" size="20">
<br>
<p>Enter the description of your site:</p>
<input type="text" name="descriptionofsite" size="80">
<p>Enter keywords for your site (seperate with commas):</p>
<input type="text" name="keywords" size="80">
<p>Enter the path to your stylesheet (if you have one, if not, don't even use this line, take it out):</p>
<input type="text" name="stylesheet" size="20">
<br><br>
<input type="submit" value="Code!">
</form>
<p>If you don't have a favicon (a favicon is the little picture you see beside the URL.)
then just take out the 2 lines that say:
<br>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<br>
<link rel="icon" href="images/favicon.ico" type="image/x-icons"></p>
</fieldset>
<br /><br />
<fieldset>
<a name="websitegenerator"></a>
<h1>Website Generator</h1>
<em>Generates the part of the website in the <body> tags.</em>
<script type="text/javascript">
/***********************************************
* Javascript Generator Script by PGReviews (Physicsguy's Reviews)
* Visit http://www.execulink.com/~kayes/physicsguy/web/ for reviews, guitar tablature, and more!
* This notice must stay intact for legal use
***********************************************/
function welcome2()
{
document.write("<h1>" + document.forms["websitegenerator"]["headertitle"].value + "</h1>);
}
</script>
<p>Enter what you want the header to say:</p>
<form name="websitegenerator" action="generator.htm" onSubmit="welcome2()">
<input type="text" name="headertitle" size="20">
<input type="submit" value="Code!">
</form>
</fieldset>
You see, I've changed all the names of the forms and all, but I'm sort of a Javan00b, so I don't know what's going on. Whenever I thpe in what I want as my header (the 2nd generator) it outputs the 1st generator with nothing filled in. Here's the fautly script in action. Why doesn't this work?
Last edited by Physicsguy; 05-18-2009 at 12:36 PM..
|