SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    access NN div layer ??

    I'm trying to access a radio button in a form within a div layer in Netscape.

    <div id="content">
    <form name="hurdle">
    <input type="radio" name="q">
    <input type="radio" name="q">
    </form>
    </div>

    Now, this doesn't work in js >>

    document.content.document.hurdle.q[0].checked;

    How can I get that value???

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cant you try

    Code:
    onchange="alert(this.checked)"

  3. #3
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I see a couple of issues:

    1. You're not using checkboxes, you're using radio buttons, so you won't find any of them being 'checked'.

    What you need to do is give them all the same name but different values:

    <form name="hurdle">
    <input type="radio" name="q" value="1">1</input>
    <input type="radio" name="q" value="2">2</input>
    <input type="radio" name="q" value="3">3</input>
    <input type="radio" name="q" value="4">4</input>
    </form>

    2. I don't have a lot of experience with netscape. I know that the way to get the value in IE would be like this:

    var yourValue = document.hurdle.q.value;

    Give that a shot and see if it works.

  4. #4
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's my complete code for a better viewpoint >>

    Here's the js code that is going to validate the form,
    right now it's just a test (no validation).
    Code:
    <script language="JavaScript" type="text/javascript">
    
    //Begin Function Validate -- Validates the form
    function validate() {
    
    var x = document.blah.document.hurdle.q[0].checked;
    alert(x);
    }
    </script>
    Here's my div/form code:
    Code:
    <div id="blah" style="position:absolute; top:136; left:48; width:215; visibility:visible">
    	<form name="hurdle" method="post">
    	<input type="hidden" value="false" name="ha">
    	<input type="radio" value="true" name="q"> True <input type="radio" value="false" name="q"> False <br><br>
    	<input type="button" value="Submit" class="button" onClick="validate();">
    	</form>
    </div>

    -----
    Last edited by meztec; Apr 4, 2002 at 08:21.

  5. #5
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright...this is actually working now ...

    The code above does/should work.

    Thanks.


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
  •