Saturday, August 9, 2008

Javascript in a Mozilla Seamonkey Composer page

When you are creating a webpage using Mozilla Seamonkey Composer, you can insert javascripts into the page in order to create dynamic content. Here are some sources you might use for dynamic javascripts and other forms of embedded HTML:
For the example in this tutorial, I'll be using the javascript from a PollDaddy.com poll. To add the javascript to your page, follow these instructions:

Create a page and type some kind of text to accompany the script, along with an XXX that marks the spot where you want to place the script results on the page:


Next, click on the HTML Source button at the bottom of the page:


Now paste the javascript (it maybe a big chunk of stuff!) into the place where you had your XXX before - in place of the XXX, you should now see the javascript code:


Now, click on Normal down at the bottom of the page to go back to your normal editing view:


Don't worry if the screen looks really weird - sometimes javascript will show up a bit oddly in this view. Here's a typical example of what you might see:

To see if your script really is working, what you need to do is SAVE YOUR WORK, and then click on the Browser Preview:


This will allow you to see if the script really is working - and in this case it is! Here's what I see when I actually preview this page in a browser window:

Close down the browser window, and you can now make any final changes you want to your webpage, and then hit Publish. As always with Seamonkey Composer, MAKE SURE YOU CLOSE THE COMPOSER WINDOW after you have published the file. If you want to keep working on the page, that's fine - just make sure you CLOSE THE COMPOSER WINDOW after publishing, and then open the page again. This is very important: if you don't close the window after you publish, you will be editing the remote copy of the page, and your local changes will be lost. So, be careful: always close the window after you publish!


Some dynamic content may not display if you are reading this blog via RSS or through an email subscription. You can always visit the How-To Tech Tips blog to see the full content, and to find out how to subscribe to the latest posts.