So, now we know some basics about improving the show on
the web site. But, to be frank, what we learned in the Chapter 4 is
just Tip of the Iceberg. Graphics is ocean, and new things arrive
every day on the net. So just we will catch up faster in this HYPER
LINKED world, we will learn what is hot today, and how FAST we can
do it.
Java scripting
Already we have discussed what is Javascript. Now we are
going to learn how to handle it.
<SCRIPT language=JavaScript
src="dynlayer.js"></SCRIPT>
That is how a Java script starts and ends. Source file is put in the
root folder, as a *.js file, which can be created/edited in a
Notepad/Wordpad. You can write the source at the *.html page itself,
but incase if it is lengthy, then you need to use a separate file.
CAUTION :-
üIt is important to upload the *.js file as ASCII method not
BINARY method. In binary mode, the carriage returns are not
interpreted properly, so you will not get desired results.
üIt is always good practice to put the scripts within <head>
…….</head> or outside the <html> …. </html> tags.. especially in IE
it tend to misbehave if it is inside body.
üAny Java Applet/servlet needs Java Virtual Machine to run. In
IE 4 and above, it is included with the browser. In IE 6 you have to
download it as a separate software.
üSome Java codes and Active X documents can even destroy a
host system, so it is a security hazard to enable Java and Active X
on all sites. IE custom security level can be used to change this
settings.
üWhile Java is a OOPS Language and thus has lot of abilities,
Java script is a limited scope web page script. Think this
difference as a difference between Visual Basic and VB script.
üVB script can not run on certain browsers/machines. So use it
if you want your web pages to be shown in windows clients only.
üRefer HTML basic Book (Chapter 1) and Thinking in Java on CD1
for in depth understanding of Java/Java script
üRefer Java script samples in CD1 for FAST java learning.
There are so much of Java scripts available for FREE download on the
Internet. Sample page with a Java script is coming with this email.
Try them on your site. If you face trouble, mail me.
Practicals
Create a Java script based Password checking page. The page should
load if password is correct. Not loads if password wrong.
CGI/PERL
scripts
Common Gateway Interface is a method of getting Form
results from the visiting public on your web. Okay, you need to have
interaction with the visitoes. Isn’t it?. So how websites interact
with people?
üLogin/Password screen
üGuest Book
üForm Mailer
üForm Results Submission
üAd rotator
üCounter
üAdvertising popups
üCookie handler and more..
So the first thing any web master needs is to create a guest book,
so that visitors can sign in their comments at the site. It is a
very common script.
There are three things that go hand in glove in any Form.
1.The user Form
2.The intermediary
processing
3.The resulting Form
The user form and the resulting form is what the user gets to see.
The intermediate processing is not shown to the user. It is executed
on the web server. That’s why FREE web companies doesn’t allow you
to put CGI scripts on their server, because it has a potential to
break down the server. A PAID web server also will monitor each
users’ CGI-BIN directory so that they don’t run dangerous codes.
CGI scripts can be wriiten in any language like C,C++,Java etc. But
most prefer PERL, because of its simplicity and customization for
CGI.
So when user
fills all these info, then presses SUBMIT, the script mentioned in
here <FORM METHOD="POST" ACTION="/cgi-sys/FormMail.cgi"> takes the
“action”. You can name it as
FormMail or
FormMail.cgi or FormMail.pl
You should set
this files’ attributes as Read, Execute for others or simply 755.
You need to know
UNIX basics to understand this.
*.cgi = CGI file
*.pl = PERL file. Refer to your web server admin for file naming
tactics.
You can edit a
CGI/PERL file in a Word Pad/Note Pad and FTP it to your server as
ASCII not BINARY.
This sample
FormMail.cgi script now runs on the server to “PARSE” (distil) the
data filled in by the user.
The hidden
scripts are extra arguments given to the parser so that a mailer
works with
To, From, Subject fields.
These hidden
fields are used in the FormMailer.cgi script so that the Form
reaches the man intended by email.
Other hidden
fields like required fields, redirect, missing field redirect ,
sort, are self explanatory, just go thru it to understand. If you
can’t get it, please mail me, I will explain.
A sample script
and a sample form is attached with this mail. Please go through them
and mail me if you face any difficulty. Also use the CGI/PERL tutor
found in Chapter 1.
Practicals
Create a Guest
Book or Form Mailer at your Freeservers web site.
Logon to you
account, go to Enhance My Site, Click Guest Book or Form Mailer to
create one. No need to write any CGI scripts. The site has some in
built customized scripts for you. Just go thru the help page there,
and use it on your site and tell me to visit it. I give 2 days to do
this. It is really that easy!