Script Categories













Forms >>> Suggestions.

Use Javascript to allow visitors to send your feedback.

Enter your name: Browser/Version:

Enter your suggestion(s):


Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function leaptoIntro() {
window.location="http://yaldex.com/JSFactory_Pro.htm"
}
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.Test.elements[1].focus();
}
function Reset() {
document.Test.elements[1].value = "";
document.Test.elements[2].value = navigator.appName + " " + navigator.appVersion;
document.Test.elements[3].value = "";
document.Test.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 true
else
return
false;
}
else
return
false;
}
function isName() {
var str = document.Test.elements[1].value;
if (str == "") {
alert("\nThe NAME field is blank.\n\nPlease enter your name.")
document.Test.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.Test.elements[1].select();
document.Test.elements[1].focus();
return false;
   }
}
return true;
}
function isBrowser() {
if (document.Test.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.Test.elements[2].value = navigator.appName + " " + navigator.appVersion;
return true;
   }
}
else
return
true;
}
function isSuggestion() {
var str = document.Test.elements[3].value;
if (str == "") {
alert("\nThe SUGGESTION field is blank.\n\nPlease enter your suggestion.")
document.Test.elements[3].focus();
return false;
}
else
return
true
}
// End -->
</script>
<FORM ENCTYPE="text/plain" NAME="Test" METHOD='POST' ACTION='mailto:you@yourdomain.com?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>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©