Hands-On: Add Script to Webpage and Preview

Normally, you would publish the script to your webspace using an FTP program or the FTP feature that is built into a web publishing system like Dreamweaver (you could also upload the javascript file to the content area of a course management system like Desire2Learn). For the purposes of this workshop, however, you have saved the javascript file to your desktop, and you will save a webpage to the desktop that uses this file - that will give you a chance to see the javascript in action without actually publishing a webpage.

To create a webpage that uses the script you have just saved, you will use the Composer program. If you do not still have Composer open, you need to open the Composer program.

1. Start a new Composer webpage. To do this, select File-New from the file menu. This will open a blank Composer webpage.

2. Type some text into the page. You can type something in the page if you want, such as "What kind of ice cream do you want?"

3. Select HTML source mode. In order to enter the script into the page, you will need to choose HTML Source mode at the bottom of the page.

4. Type in the script. You will need to type in the script information manually in HTML It should go after the text that you typed, and before the </body> tag which marks the end of the webpage content. Here is what you should type, substituting the name of your script if it is not called icecream.js:
<script type="text/javascript" src="icecream.js"></script>

5. Save the page. Either click on the Save icon or choose File-Save and save the page. You will be prompted to give the page a "title" (this is not the name of the file, so you can use normal spaces, punctuation, capitalization, etc.) You can give this webpage the title: "Ice Cream!!!" if you want.

Then save the file to the desktop with a name that contains no spaces or punctuation, using lower-case letters only. For example: icecream.

6. View the page. In order to see what this webpage would look like when it is published on the Internet, click on the Browse icon in order to see the page displayed in a browser window.

You should see your page with the text you typed, together with the contents of the script you have selected. If you have selected a random content script, press the Reload button in the browser to see new content displayed each time the page is reloaded.

 

 

 

 

 

 

 

 

 

 

 

 

 


Contact: laura-gibbs@ou.edu or visit mythfolklore.net. Last updated: July 22, 2005 1:13 PM