»
EnglishFrenchVietnamese

Print - Suggestions - JavaScriptBank.com

Full version: jsB@nk » Form » Validation » Suggestions
URL: https://www.javascriptbank.com/suggestions.html

Suggestions © JavaScriptBank.comUse JavaScript to allow visitors to send your feedback.

Full version: jsB@nk » Form » Validation » Suggestions
URL: https://www.javascriptbank.com/suggestions.html



JavaScript
<SCRIPT LANGUAGE="JavaScript"><!-- Beginfunction leaptoIntro() {window.location="http://jsbank.beplaced.com"}function About() {alert("\nHave a suggestion for a JavaScript example?\n\nFill out the form and submit it. I will see what I can do.\n\nPlease be as specific as possible.");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[3].value = "";document.forms[0].elements[1].focus();}function submitForm() {if ( (isName() ) && (isBrowser()) && (isSuggestion()) ) {if (confirm("\nYour submission is about to be sent.\n\nClick YES to submit.\n\nClick NO to cancel.")) return trueelsereturn false;      }elsereturn 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 trueelse{document.forms[0].elements[2].value = navigator.appName + " " + navigator.appVersion;return true;         }}elsereturn true;}function isSuggestion() {var str = document.forms[0].elements[3].value;if (str == "") {alert("\nThe SUGGESTION field is blank.\n\nPlease enter your suggestion.")document.forms[0].elements[3].focus();return false;}elsereturn true   }// End --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="Reset()"><FORM ENCTYPE="text/plain" NAME="test" METHOD='POST' ACTION='mailto:[email protected]?subject=JS Suggestions' onSubmit="return submitForm()"><INPUT TYPE="hidden" NAME="form1" VALUE="JS Suggestions"><TABLE BORDER=0 WIDTH=564><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=26 MAXLENGTH=40><TD align="center"> <INPUT TYPE="text" NAME="browser"   SIZE=26 MAXLENGTH=40></TR></TABLE><BR><TABLE BORDER=0><TR><TD align="center"> <FONT><STRONG>Enter your suggestion(s):</STRONG></FONT></TR><TR><TD align="center"><TEXTAREA NAME="suggestions" ROWS=2 COLS=55 wrap=yes></TEXTAREA></TR></TABLE><BR><BR><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></TABLE></FORM></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->