Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Related items

Image Manipulation Techniques

String Gradients the Fun Way!

"The Light Fantastic"

MSIE Page Transition Filters

A Gift of "Life" : The Document Object Model

Multimedia in Microsoft Internet Explorer

Displaying Temporary Pages

Dynamic Positioning

What is So Dynamic About Dynamic HTML?

Fancy Background Fader

Building a Dynamic Thank You Page- source

You are here: irt.org | Articles | Dynamic HTML (DHTML) | Building a Dynamic Thank You Page [ previous next ]

Published on: Monday 15th June 1998 By: Martin Webb

Return

index.htm

<HTML>

<HEAD>
<TITLE>Input Page</TITLE>

<SCRIPT language="JavaScript"><!--
var debug = true; // replace with:  var debug = false;

function thankYou(form) {
    form.redirect.value = 'thanks.htm' + '?' +
        escape('Action')             + '=' + escape('Feedback')          + '&' +
        escape('Message Sent To')    + '=' + getText(form.SendMailTo)    + '&' +
        escape('Your Age')           + '=' + getRadio(form.age)          + '&' +
        escape('Favourite Color')    + '=' + getOption(form.color)       + '&' +
        escape('Your Hobbies')       + '=' + getCheckboxes(form.Computing,form.Carpentry,form.Drawing,form.Reading) + '&' +
        escape('Your Email Address') + '=' + getText(form.email)         + '&' +
        escape('Your Name')          + '=' + getText(form.yourname)      + '&' +
        escape('Comments')           + '=' + getText(form.comments)      + '&';

    if (debug) {
        location.href = form.redirect.value;
        return false;
    }

    return true
}

function getText(object) {
    return escape(object.value)
}

function getOption(object) {
    return escape(object.options[object.selectedIndex].text);
}

function getRadio(object) {
    for (var i = 0; i < object.length; i++)
         if (object[i].checked)
             return object[i].value;

    return '';
}

function getCheckboxes() {
    var output = '';
    for (var i = 0; i < getCheckboxes.arguments.length; i++)
         output += getCheckbox(getCheckboxes[i]) + escape(' ');
    return output;
}

function getCheckbox(object) {
    if (object.checked)
        return escape(object.value);
    else
        return '';
}
//--></SCRIPT>

</HEAD>

<BODY>

<FONT FACE="Arial, Helvetica">

<H1>Dynamic Thank You Page</H1>

<FORM METHOD="POST" ACTION="/cgi-bin/userform.cgi" onSubmit="return thankYou(this)">

<INPUT TYPE="HIDDEN" NAME="SendMailTo" VALUE="martin.webb@btinternet.com">

<INPUT TYPE="HIDDEN" NAME="redirect" VALUE="thanks.htm">

<P>Comments:
<BR><TEXTAREA NAME="comments" COLS="38" ROWS="4" WRAP="VIRTUAL"></TEXTAREA>

<P>Your age:
<BR>
<INPUT TYPE="RADIO" NAME="age" VALUE="5-15">  5-15
<INPUT TYPE="RADIO" NAME="age" VALUE="16-25"> 15-25
<INPUT TYPE="RADIO" NAME="age" VALUE="26-35"> 26-35
<INPUT TYPE="RADIO" NAME="age" VALUE="36-45"> 36-45
<INPUT TYPE="RADIO" NAME="age" VALUE="46-55"> 46-55
<INPUT TYPE="RADIO" NAME="age" VALUE="56-65"> 55-65

<P>Your favourite color:
<SELECT NAME="color">
<OPTION>Red
<OPTION>Orange
<OPTION>Yellow
<OPTION>Green
<OPTION>Blue
<OPTION>Indigo
<OPTION>Violet
</SELECT>

<P>Your Hobbies:
<BR>
<INPUT TYPE="CHECKBOX" NAME="Computing" VALUE="Computing"> - Computing
<INPUT TYPE="CHECKBOX" NAME="Carpentry" VALUE="Carpentry"> - Carpentry
<INPUT TYPE="CHECKBOX" NAME="Drawing" VALUE="Drawing"> - Drawing
<INPUT TYPE="CHECKBOX" NAME="Reading" VALUE="Reading"> - Reading

<P>Your e-mail address:
<BR><INPUT TYPE="TEXT" SIZE="38" NAME="email">

<P>Your name:
<BR><INPUT TYPE="TEXT" SIZE="38" NAME="yourname">

<P><INPUT TYPE="SUBMIT" VALUE="Submit">

</FORM>

</BODY>
</HTML>
Return

thanks.htm

<HTML>

<HEAD>
<TITLE>Thank You</TITLE>
</HEAD>

<BODY>

<FONT FACE="Arial, Helvetica">

<H1>...Message Received</H1>

<SCRIPT LANGUAGE="JavaScript"><!--
var input = '', output = '';

if (location.search.length > 0)
    input = location.search.substring(1);

while (input.length > 0) {
    variableName = input.substring(0,input.indexOf('='));
    input = input.substring(input.indexOf('=')+1);
    variableValue = input.substring(0,input.indexOf('&'));
    input = input.substring(input.indexOf('&')+1);
     
    output += '<P><B>' + unescape(variableName) + ':<\/B>';
    output += '<XMP>' + unescape(variableValue) + '<\/XMP>';
}

document.write(output);
//--></SCRIPT>

<H2>Thank you!</H2>

</FONT>

</BODY>
</HTML>
Return

Related items

Image Manipulation Techniques

String Gradients the Fun Way!

"The Light Fantastic"

MSIE Page Transition Filters

A Gift of "Life" : The Document Object Model

Multimedia in Microsoft Internet Explorer

Displaying Temporary Pages

Dynamic Positioning

What is So Dynamic About Dynamic HTML?

Fancy Background Fader

©2018 Martin Webb