Need help with goToURL

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default Need help with goToURL

    Good Evening,

    I am trying to get the following Javascript and HTML code to function
    correctly, but continuously receiving errors with the "else statement".

    JAVASCRIPT
    ------------------
    function goToURL()
    {
    pdtotal = document.myform1.productdensity1.value

    if ( pdtotal >= 1 );
    {
    alert(" entering IF and GT or Equal to One (1) ");
    window.location="05-CBM Freight Classes Page.htm";
    }
    else
    {
    alert(" entering ELSE and LT or Equal to Zero (0) ");
    }
    }

    HTML
    --------
    <input type=button tabindex="4" value="Go To Next Screen"
    onClick="goToURL()">

    Thanks,

    Mike


    E9 Mike Guest

  2. Similar Questions and Discussions

    1. Datagrid gotoURL
      Is it possible that on select of an item in the datagrid I can goto a url? I have been trying to figure this out but haven't seen anything posted...
    2. goToURL
      How do I open a new page when using the goToURL behaviour. Here is code generated by Dreamweaver MX 4: <a href='javascript:;'...
  3. #2

    Default Re: Need help with goToURL

    Mike,

    I'm probably a bit too late, but figured I'd throw this up anyways.

    I made some changes, but the following worked fine for me. I didn't know what
    kind of form element 'productdensity1' was, so I just wrote it up as a text
    field. So you'll have to change that part depending on your needs. Anyways,
    here's the code:





    /*--------------- Javascript -------------------------- */
    function goToURL() {
    var pdtotal = document.forms['myform1'].elements['productdensity1'].value;
    if(pdtotal >= 1) {
    alert('entered if statement');
    window.location = 'http://www.yoursite.com/yourpage.html';
    } else {
    alert('entered else statement');
    }
    }


    HTML

    <form action="" name="myform" id="myform1">
    <input type="text" name="productdensity1" id="productdensity1" value="test">
    <input type="button" name="nextbutton" id="nextbutton" value="Go to next
    screen" onClick="goToURL();">
    </form>

    rilkesf Guest

  4. #3

    Default Re: Need help with goToURL

    rilkesf,

    Thanks for the tip. I did finally figure it out, but , your comments were
    beneficial and I will keep them for future use. I do have another question, I
    am trying to figure out how to pass data from one form (web page 1) to another
    form (web page 2), any thoughts.

    E9
    Mike:beer;:D:brokenheart;:camera;:brokenheart;:D:b eer;:beer;:D:brokenheart;:came
    ra;:clock;:camera;:brokenheart;:D:beer;

    E9 Mike Guest

  5. #4

    Default Re: Need help with goToURL

    Sorry for all the Icons, slip of the mouse.
    E9 Mike Guest

  6. #5

    Default Re: Need help with goToURL

    The easiest way is to capture the information from page 1 with whatever dynamic
    language you are using (PHP, ASP, etc.) and insert it into a variable. Then
    you can reuse the form information on page 2 by calling the variable.

    For example, in PHP you would insert this on page 2:

    <?php
    $passed_info = $_GET['field_name'];
    ?>

    Where 'passed_info' is whatever you want to call your variable, '$_GET' is the
    method you specified for your form on page 1 (either 'get' or 'post'), and
    'field_name' is what you named the form field you want to capture.



    rilkesf Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139