Javascript version of the form

HTML Help Page Comment Form


Using this Javascript Form will "FREE" you of using the Yahoo!GeoCities mail service and having to FORWARD the form to your REGULAR mail server. It will send the form DIRECTLY to your REGULAR mail server.

This Javascript Form is offered to those who are capable of understanding SOME Javascript. I have tried to simplify the form requirements by adding NOTES at the bottom of the page for MODIFYING the form. Often people are able to determine how a Javascript operates by "viewing" it and studying the elements and then "tinkering" with it until it operates to meet their needs. That is what is intended in this case. The script is offered AS IS, with NO responsibility assumed for DAMAGE or problems caused through it's use.


Enter your name: Browser/Version:
(Do not hit return)

Please enter your URL:
(Do not hit return)
Please enter your E-mail address:
(Do not hit return)


1) What level of HTML do you possess?

No knowledge
Very little knowledge
Some knowledge
Quite a lot of knowledge
I'm an HTML Guru


2) How often do you visit my page?

Every day
Once per week
Once per month
Once per year


3) Of the pages within the HTML Help Pages which did you find MOST helpful?


4) Please provide your comments about my page


After submitting this form please click the "CLOSE" button.





Javascript for the Form


<!-- THREE STEPS TO INSTALL THIS JAVASCRIPT FORM: 1. Paste the coding into the HEAD of your HTML document 2. Add the onLoad event handler to the BODY tag 3. Put the last code into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <HTML> <HEAD><title>Javascript Form</title> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function leaptoIntro() { window.location="http://www.oocities.org/ResearchTriangle/Node/1533/thanks.html" } function About() { alert("\nI'm very interested in the usage of the HTML Help Page and what I can do to improve it."); document.forms[0].elements[1].focus(); } function Reset() { document.forms[0].elements[1].value = ""; document.forms[0].elements[2].value = navigator.appName + " " + navigator.appVersion; document.forms[0].elements[4].value = ""; document.forms[0].elements[15].value = ""; document.forms[0].elements[1].focus(); } function submitForm() { if ((isName()) && (isBrowser()) && (isEmail()) && (isComments())) { if (confirm("\nYour submission is about to be sent.\n\nClick OK to submit.\n\nClick CANCEL to cancel.")) return true else return false; } else return false; } function isName() { var str = document.forms[0].elements[1].value; if (str == "") { alert("\nThe NAME field is blank.\n\nPlease enter your name.") document.forms[0].elements[1].focus(); return false; } for (var i = 0; i < str.length; i++) { var ch = str.substring(i, i + 1); if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') { alert("\nThe NAME field only accepts letters & spaces.\n\nPlease re-enter your name."); document.forms[0].elements[1].select(); document.forms[0].elements[1].focus(); return false; } } return true; } function isBrowser() { if (document.forms[0].elements[2].value != navigator.appName + " " + navigator.appVersion) { if (confirm("\nYou've changed your browser type.\n\nClick YES to keep changes.\n\nClick NO to restore detected browser.")) return true else { document.forms[0].elements[2].value = navigator.appName + " " + navigator.appVersion; return true; } } else return true; } function isEmail() { var str = document.forms[0].elements[4].value; if (str == "") { alert("\nThe Email field is blank.\n\nPlease enter your Email address.") document.forms[0].elements[4].focus(); return false; } else return true } function isComments() { var str = document.forms[0].elements[15].value; if (str == "") { alert("\nThe COMMENTS field is blank.\n\nPlease enter your comments.") document.forms[0].elements[15].focus(); return false; } else return true } // End --> </SCRIPT> <!-- STEP TWO: Add this onLoad event handler to the BODY tag --> <BODY BGCOLOR="#FFFFFF" TEXT="#0000BB" onLoad="Reset()"> <!-- STEP THREE: Copy this code into the BODY your HTML document --> <center><H2><font color="#FF0000">HTML Help Page Comment Form</font></H2></center> <br> <FORM ENCTYPE="text/plain" NAME="test" METHOD='POST' ACTION='mailto:dcrum@infionline.net?subject=HTML Help Page' onSubmit="return submitForm()"> <INPUT TYPE="hidden" NAME="form1" VALUE="HTML Help Page"> <TABLE BORDER=0> <TR> <TD align="center"> <FONT><STRONG>Enter your name:</STRONG></FONT> <TD align="center"> <FONT><STRONG>Browser/Version:</STRONG></FONT> </TR> <TR> <TD align="center"><INPUT TYPE="TEXT" NAME="NAME" SIZE=30,1 MAXLENGTH=40><STRONG><font color="#FF0000"> (Do not hit return)</font></STRONG> <TD align="center"><INPUT TYPE="text" NAME="browser" SIZE=26 MAXLENGTH=40> </TR> </TABLE> <br> <STRONG>Please enter your URL:</STRONG> <br> <INPUT TYPE="TEXT" NAME="URL" VALUE="http://" SIZE=50,1 MAXLENGTH=60><STRONG><font color="#FF0000"> (Do not hit return)</font></STRONG> <br><STRONG> Please enter your E-mail address:</STRONG> <br><INPUT TYPE="TEXT" NAME="E-mail" SIZE=40,1 MAXLENGTH=40> <font color="#FF0000"><STRONG> (Do not hit return)</STRONG></font> <p> <br> <dl> <dt><STRONG> 1) What level of HTML do you possess?</STRONG><p> <dd><input type=radio name="level" value= "none">No knowledge<br> <dd><input type=radio name="level" value= "very_little">Very little knowledge<br> <dd><input type=radio name="level" value= "some_knowledge">Some knowledge<br> <dd><input type=radio name="level" value= "quite_a_lot">Quite a lot of knowledge<br> <dd><input type=radio name="level" value= "html_guru">I'm an HTML Guru<br> <p> <br> <dt><STRONG> 2) How often do you visit my page?</STRONG><p> <dd><input type=radio name="visit" value="daily">Every day<br> <dd><input type=radio name="visit" value="weekly">Once per week<br> <dd><input type=radio name="visit" value="monthly">Once per month<br> <dd><input type=radio name="visit" value="yearly">Once per year<br> </dl> <p> <br> <dl> <dt><STRONG> 3) Of the pages within the HTML Help Pages which did you find MOST helpful?<STRONG><p> <SELECT NAME="Most Helpful Page"> <OPTION selected> Main HTML Help page <OPTION> Upload Page <OPTION> Basic HTML <OPTION> Mouseovers <OPTION> Promotion <OPTION> Sound Tags <OPTION> Image Tags <OPTION> Basic HTML document <OPTION> Start HTML <OPTION> Move In HTML <OPTION> Basic Document <OPTION> Image Display <OPTION> Sounds/Music Tags <OPTION> Links Page <OPTION> Frames Page <OPTION> Fonts Page <OPTION> Counter Help <OPTION> GeoGuide Help <OPTION> GuestBook Help <OPTION> Popup Help <OPTION> Table Page <OPTION> Form Page <OPTION> Real Audio Page <OPTION> Image Carousel <OPTION> JS Error Suppressor <OPTION> New Window Link <OPTION> Pull Down Window <OPTION> Pull Down for Frames <OPTION> Automatic Menu <OPTION> Page Update <OPTION> Popup Alert <OPTION> Background Fade <OPTION> Background Color <OPTION> Meta Tag Generator </SELECT> </dl> <p> <br> <dl> <dt><STRONG> 4) Please provide your comments about my page</STRONG><p> <TEXTAREA NAME="Comments" ROWS=12 COLS=55></TEXTAREA> <p> <dt> <BR> After submitting this form please click the "CLOSE" button. <TABLE BORDER=0 WIDTH=300> <TR> <TD align="center"><INPUT TYPE="submit" VALUE="Submit"> <TD align="center"><INPUT TYPE="reset" VALUE="Reset" onClick="Reset()"> <TD align="center"><INPUT TYPE="button" VALUE="About" onClick="About()"> <TD align="center"><INPUT NAME="update" TYPE="BUTTON" VALUE="Close" OnClick="leaptoIntro()"> </TR> </STRONG> </TABLE> <br> <INPUT TYPE="hidden" NAME="subject" VALUE="Most Helpful HTML page"> <br> <br> </FORM> Notes for Modifying the Script:

1. Near the beginning of the form script you will find - function leaptoIntro()
This is the location you should place the page where you wish people to go after clicking the the CLOSE button at the bottom of the form. I have used it to direct people to a Thank You page with a LINK to the Main HTML Help Page from there.

2. Next comes the - function About()
This is where you need to REPLACE the TEXT I have inserted to tell people who want to know what the form is FOR/ABOUT when they CLICK on the ABOUT button at the bottom of the form.

3. Next comes the - function Reset()
This is more involved and can be extremely confusing. If you understand some JS it will not be nearly as confusing. Regardless, this is where you set the attributes to which the user will be RESET if they attempt to SUBMIT the form without completing the areas you specify there which MUST be completed. It will cause an ALERT to "popup" telling them they have left something BLANK and when they close the alert it will take the cursor automatically to that point they have NOT completed.
If you look at the example above you will see the "elements" which must be completed are: 1, 2, 4, and 15. These are the NAME, BROWSER/VERSION, E-Mail address and the COMMENTS sections. It is probably a good idea NOT to require any "input" for the URL of the person as many will not have one as yet, or may never have one.
To determine the NUMBER of the ELEMENT to place in the [ ] location in the JS just COUNT each item from the TOP of the form which may be used as an input. Look at the DISPLAYED page of the FORM and you will see there is a LOCATION to input the 1.) NAME, 2.) BROWSER/VERSION, 3.) URL, 4.) E-MAIL ADDRESS, then 5.) 5 radio buttons under the 1st question, 6.) 4 radio buttons under the 2nd question 7.) 1 input window for a selection in the 3rd question and 8. the TEXTAREA for the COMMENTS. If you add them all up you can see how I arrive at 15 for the TEXTAREA in the RESET.

4. Next comes the - function submitForm()
This is where you define each area which is to be checked for completion upon CLICKING the SUBMIT button. Notice in this example I have FOUR (4) areas set for "checking." They are listed in this manner ((isName()) && (isBrowser()) && (isEmail()) && (isComments()). For each the script will check for completion by checking TRUE or FALSE and will take the appropriate action. It will RESET after sending an ALERT which must be CLICKED and resetting the cursor to the area which is NOT completed. You will have to ADD another AREA to this line if you want it to be checked.

5. Next comes the INDIVIDUAL coding which the script checks to ensure the information in each area is completed or not. Each area identified in (4.) above, must be defined in this area. For areas other than the ones already indicated you should ADD a similarly coded line. Remember, you need to have an entry here for each area in the paragraph above.

This is difficult to explain and some "tinkering" on your part may be needed to see exactly how the script operates.

Briefly, to repeat, you will have to "identify" each area you want "checked" in the "function Reset()" area...then you need to include each area in the "function submitForm()" line where they will be checked when the SUBMIT button is clicked, and last...you need to "expand each definition" in the following lines.

Addition of the ONLOAD Event Handler is fairly self-explanatory. Just add - onLoad="Reset() - to the tag.

ADDING the HTML to your script:
The first FOUR (4) areas, the NAME, BROWSER/VERSION, URL, and E-MAIL will probably be retained in most forms. Those are already coded in the script and should be left as is, for the most part. The AREAS which you wish to include beneath those first FOUR can be any type acceptable in all forms. For help with that go to the Main Frame page. Each type is explained. You can ADD TO, DELETE, or MODIFY the existing areas as needed. Studying the areas will allow you to see where the TEXT should be added for each area.

After you have the AREAS/QUESTIONS added you will have to include the HTML for the BUTTONS. Unless you want to DELETE one of the buttons for some reason (I would leave them as is) you just use the coding as is. You can study the buttons and the information they present ABOVE in the FIRST section of the form.



Main Form Page

Main HTML Help

Site© 1996-2003 Copyright by dcrum@infionline.net