Writing your JavaScript directly onto the page.

Here is a new statement that will write what you want onto the page.

document.writeln("text in qoutes just like the alert "+variables+" more text and <html> tags")

Here is the script I used to welcome you to this page. I also added another variable manipulation to this script that I haven't gone over yet.
<SCRIPT LANGUAGE = "JavaScript">
<!-- Hide
var name = prompt("What is your name?","");
var welcome = ("Welcome to my page "+name);
document.writeln("<center><h1>"+welcome+"</center></h1>")
// End Hide -->
</SCRIPT> I took the variable name and added it to the text and named it a new variable. I also could have put the html tags into the variable instead of into the document.writeln statement.
var welcome = ("<center><h1>Welcome to my page "+name+"</h1></center>") Now what if you want to have a comment come up somewhere else on the page. like this.
I did this buy putting a script inside the page.
<script>
document.writeln("Sing my guestbook "+name)
</script>
Of course I left out the hide browser so if someone looking at this page did not have a JavaScript browser they would just see the document.writeln("sign my guestbook "+name) instead of what you wanted.

Now how did I get it to write something in the middle of the page. I wrote a second script on the page exactly where I wanted the statement written to. Here is the script.

<script>
docuent.writeln(second)
</script> In my script at the top of the page I asked for your name. I took some words Sign my guest book and place them in a variable called second. I also added the variable name where your name is stored and had the whole statement stored for use by the second script. Here's how I made the variable in case you don't remember how to alter or create variables
var second=("Sing my guestbook "+name);
This variable creation had to come after the variable name had be created by the prompt. After the first script had ended the page was loaded down to the point where it got to the second script. Then it wrote out the variable second and then finished the rest of the html on the page.

I will add more or fix any mistakes on this page as I learn more.


|| index||page 1||page 2||page 3||page 4||page 5||page 6||page 7||Page 8||
||glossary||library||Links||Labratory||Awards||