Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    This simple does not work in firefox

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html><head>
    <title>test</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <script language="JavaScript" type="text/JavaScript">
    <!-- hide from old browsers
    function check() {
    if ((!registration.f.checked) && (!registration.sa.checked)) {
    alert('Please pick something.');
    event.returnValue=false;
    }
    }
    //-->
    </script>
    </head>
    <body>
    <form name="registration" onSubmit="return check();">

    <table align="center" border="0" cellpadding="5" cellspacing="2" width="600">
    <tbody><tr>
    <td align="left" bgcolor="#cccccc" valign="top"> <input name="f" id="f" value="1" checked="checked" type="checkbox"> <strong>text1</strong></td>
    </tr>
    </tbody></table>


    <table align="center" border="0" cellpadding="5" cellspacing="2" width="600">
    <tbody><tr>
    <td class="bodytxt" align="left" bgcolor="#cccccc" valign="top"> <input name="sa" id="sa" value="1" type="checkbox"> <strong>text2</strong></td>
    </tr>
    </tbody></table>
    <table align="center" border="0" cellpadding="5" cellspacing="2" width="600">
    <tbody><tr>
    <td align="center" bgcolor="#eeeeee" valign="middle"><input class="input_field" value="Subscribe" type="submit"></td>
    </tr>
    </tbody></table>
    </form>
    </body></html>

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    the document's elements should be refered with the root document.

    PHP Code:
    function check() {
    if ((!
    document.registration.f.checked) && (!document.registration.sa.checked)) {
    alert('Please pick something.');
    return 
    false;
    }

    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Just a quick look:

    when referencing an element you must include the document object
    Code:
    if ((!registration.f.checked) && (!registration.sa.checked)) {
    should be
    Code:
    if ((!document.registration.f.checked) && (!document.registration.sa.checked)) {
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    only when refering a window's element, you may omit the root, as it's supposed that all the elements/objects are window's childs:

    ie:

    location
    event
    history
    navigator
    screen

    and so on

    and the methods associated (if applied upon window)

    close()
    alert()
    focus()
    print()

    and so on

    Take a look at a quite good object structures in JavaScript at:
    http://www.howtocreate.co.uk/tutoria...?tut=0&part=23
    Last edited by Kor; 01-14-2005 at 05:32 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you

    Thank you so much. You guys are FAST!

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    Thumbs up

    Neh... we are quite lazy... This is why I've spent a little extra time to explain you some and to point you towars some documentation to be sure that next time you will not ask us the same type of questions


    ...only joking... good luck!
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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