Results 1 to 8 of 8

Thread: Onclick help needed!

  1. #1
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Onclick help needed!

    I'm hoping someone can help me - here's my webpage I'm working on:

    http://www.vendorman.net/vmacredit/register.html

    When the user selects: Individual Owner, the page should forward to https://www.3579.net/secure/vma/form_ind.html

    When the user selects: Management Company, the page should forward to https://www.3579.net/secure/vma/form_man.html

    The problem is that regardless of what the user selects, it always goes to the Individual Owner page. I can't get it to work even when the user actually SELECTS Management Company. I'm sure it's my coding that's messed up. Here's my coding in that section:

    </p><form method="post" name="frm" action="">
    <blockquote>
    <table border="0" cellpadding="0" cellspacing="2">
    <tbody><tr>
    <td><input value="1" name="select" id="select" type="radio"></td>
    <td><b>Individual Owner</b>&nbsp;</td>
    <td>
    <img src="../images/icon_info1.gif" class="LEVEL1" id="OUT1i" border="0" width="10" height="10"></td>
    <td class="smallprint"><a class="LEVEL1" id="OUT1t" style="text-decoration: none; color: rgb(0, 0, 255);">Explain</a></td>
    </tr>
    </tbody></table>
    <table style="display: none;" id="OUT1s">
    <tbody><tr>
    <td>
    <!-- start hidden content -->
    <p class="smallprint">You are the actual owner of the rental
    property(ies). If you are the owner of the property(ies) but you have
    set up a management company to manage your own properties (i.e., you
    have created a corporation or LLC), and that entity manages the
    properties, then you would sign up as a management company.</p> </td>
    </tr>
    </tbody></table>
    <table border="0" cellpadding="0" cellspacing="2">
    <tbody><tr>
    <td><input value="2" name="select" id="select" checked="checked" type="radio"></td>
    <td><b>Management Company</b>&nbsp;</td>
    <td>
    <img src="../images/icon_info1.gif" class="LEVEL1" id="OUT2i" border="0" width="10" height="10"></td>
    <td class="smallprint"><a class="LEVEL1" id="OUT2t" style="text-decoration: none; color: rgb(0, 0, 255);">Explain</a></td>
    </tr>
    </tbody></table>
    <table style="display: none;" id="OUT2s">
    <tbody><tr>
    <td>
    <!-- start hidden content -->
    <p class="smallprint">You are a company (corporation or LLC) that
    manages or rents rental properties for other people or companies. Real
    Estate agents also qualify under this category.</p> </td>
    </tr>
    </tbody></table>
    <table style="display: none;" id="OUT3s">
    <tbody><tr>
    <td>
    <!-- start hidden content -->
    <p class="smallprint">You would like debt collection services only. You
    may add credit report capability later. This option allows instant
    sign-up with VMACredit.</p> </td>
    </tr>
    </tbody></table>
    <p><input value="Start Now!" type="button" onClick="javascript:if(document.getElementById('se lect').value==1){document.frm.action='https://www.3579.net/secure/vma/form_ind.html';}else{document.frm.action='https://www.3579.net/secure/vma/form_man.html';}document.frm.submit();"></p>
    </blockquote>
    </form>
    <br></td>
    </tr>
    </tbody></table> </td>
    </tr>
    </tbody></table> </td>
    </tr>
    <tr>
    <td width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
    </tr>
    <tr>
    <td bgcolor="#ffcc66" width="100%"><img src="http://www.vendorman.net/images/fill.gif" border="0" height="5" width="700"></td>
    </tr>
    <tr>
    <td width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
    </tr>
    <tr>
    <td bgcolor="#000000" width="100%"><img src="images/fill.gif" border="0" height="1" width="700"></td>
    </tr>
    <tr>
    <td width="100%">&nbsp;</td>
    </tr>
    </tbody></table>
    </center>
    <script language="javascript" src="images/referdetect.htm"></script>
    <script language="JavaScript">
    var img1 = new Image();
    img1.src = "images/icon_info1.gif";
    var img2 = new Image();
    img2.src = "images/icon_info2.gif";
    function doOutline() {
    var srcId, srcElement, targetElement;
    srcElement = window.event.srcElement;
    if (srcElement.className.toUpperCase() == "LEVEL1" ||
    srcElement.className.toUpperCase() == "FAQ") {
    srcID = srcElement.id.substr(0, srcElement.id.length-1);
    targetElement = document.all(srcID + "s");
    srcElement = document.all(srcID + "i");

    if (targetElement.style.display == "none") {
    targetElement.style.display = "";
    if (srcElement.className == "LEVEL1")
    srcElement.src = img2.src;
    } else {
    targetElement.style.display = "none";
    if (srcElement.className == "LEVEL1") srcElement.src = img1.src;
    }
    }
    }
    document.onclick = doOutline;
    </script>
    </body></html>

    ****************************************
    So if you can tell me where my coding is messed up, please do. I'm trying to find out how to make the page forward to the Management page when the radio button is put in that section. Please help if you can!!

    Thanks,

  2. #2
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I haven't looked at you code, but here s a quick example which might help you recode

    http://www.b3ta.cr3ation.co.uk/data/htm/radioselect.htm

    good luck.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That code's vastly overcomplicated, and uses several very poor practices (eval() is very rarely necessary). A nicer way of doing it is something like this:
    Code:
    <script type="text/javascript" src="http://www.twey.co.uk/pythonic.js"></script>
    <script type="text/javascript">
      Twey.Pythonic.LOAD("Array.filter");
      var actions = {
        'google' : "http://www.google.com/",
        'yahoo' : "http://www.yahoo.com/"
      };
    </script>
    <form action="redirect.php" onsubmit="return (this.action = actions[Array.prototype.slice.call(this.elements['destinations']).filter('checked')[0].value]);">
      <div>
        <label>
          <input type="radio" value="google" name="destinations"> Google
        </label>
        <label>
          <input type="radio" value="yahoo" name="destinations"> Yahoo
        </label>
        <input type="submit" value="Go">
      </div>
    </form>
    Last edited by Twey; 04-15-2007 at 08:55 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Won't work in IE. You have to specify the same name attribute for the to checkboxes.
    - Mike

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <script type="text/javascript">
      var actions = {
        'google' : "http://www.google.com/",
        'yahoo' : "http://www.yahoo.com/"
      };
      function send(el) {
        var obj = el;
        for (var i=0;i<obj.elements.length;i++)
          if (obj.elements[i].checked) return actions[obj.elements[i].value]
      };
    </script>
    <form action="" onsubmit="return (this.action = send(this));">
      <input type="radio" value="google" name="foo"> Google
      <input type="radio" value="yahoo" name="foo"> Yahoo
      <input type="submit" value="Submit">
    </form>
    - Mike

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Oh, yes, sorry, that's not just an IE thing. Edited.

    But what's the Transitional DOCTYPE for? :-\
    Last edited by Twey; 04-15-2007 at 09:01 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks for your replies!

    However, I'm trying to keep the coding intact and just fix the part that is causing it to NOT forward to the proper URL. I understand that my script is completely overly complicated but if you could help me just to tell me what part I need to fix so that it works, it would be most appreciated.

    Thanks,

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not just overly complicated, it's poorly written. You'll have a lot more luck adjusting that one to suit your page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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