Haha, funny little pun in the title.
Awhile back, I posted a question on how to make one of those fancy online generators. All I got were PHP answers, or simply "it's impossible". Well, not anymore!
I'm sort of a noob with Javascript, but this has made me really proud of what I made, hopefully it will help all the less-fortunate people who's host doesn't support PHP!
Code:
<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 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=\"http://www.webmaster-talk.com/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="Submit">
</form>
There it is. That just makes a simple head section generator, which I am using here.
If you would like to use it, please keep the notice for my site and all in the top part. Please don't steal it.
I'm sorry if this has already been brought up, or just common knowledge anyway. Please don't roast me if so, as I said, I'm very proud of this. I've chosen to share it (even though you could just hack it anyway  ) because I would like the world to know that it's possible!
And yes, the actual output code must be one long, very long line. If it's possible to clean it up (as I said I'm a noob) please say!
Last edited by Physicsguy; 05-02-2009 at 10:12 PM..
Reason: Added Content
|