Results 1 to 3 of 3

Thread: I want to display a field passed to my html

  1. #1
    Join Date
    Mar 2010

    I want to display a field passed to my html

    Say I have a url like this:


    I've carriage returns in there so you can read it easier.

    How do I display the passed fields on the html page?

  2. #2
    Join Date
    Mar 2010
    To view the name/value pairs in a query string in the target html page, you have to parse the query string after which you can then display the reults on the web page.

    This script should do what you are after:

    <script type="text/javascript">
    if (window != top) top.location.href=location.href
    document.write("\<h2>You entered the following data:</h2>");
    var formData = location.search;
    formData = formData.substring(1, formData.length);
    while (formData.indexOf("+") != -1) {
    formData = formData.replace("+", " ");
    formData = unescape(formData);
    var formArray = formData.split("&");
    for (var i=0; i < formArray.length; ++i) {
    document.writeln(formArray[i] + "<br />");

  3. #3
    Join Date
    Mar 2010
    Thanks! I was almost there, but was lacking what I needed to remove the +'s and insert spaces. You rock!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center