SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.opener.document["nameForm"].getElementById("someid").value; doesnt work

    Hello guys

    i really need your help

    i have a popup window, then when i finished (pressing submit button) call onSubmit
    method of the form and then call some method in javascript (the js file is an external file) and use some sentence how this

    Code:
    window.opener.document["nameForm"].getElementById("someid").value;
    well this doesnt work
    now if the element is a textinput how
    Code:
    <input type="text" name="somename" value=""  id="someid"/>
    i can use this to avoid the problem
    Code:
    window.opener.document["nameForm"].somename.value;
    now the problem is this
    Code:
    <span name="othersomename" id="othersomenid" style="display:none;">
        <h1>some data</h1>
                    ...
    </span>
    with span the name property is ignored
    so if i use this
    Code:
        window.opener.document["nameForm"].othersomename.style.display="";
    i recive the error message
    window.opener.document.nameForm.othersomename has no properties
    or
    Code:
    window.opener.document["nameForm"].getElementById("othersomenid").style.display="";
    i recive this error message:
    window.opener.document.nameForm.getElementById is not a function


    pls, how i can resolve this???

    thanks so much for advanced

    BTW : i am using firefox 1.5.0.9 in linux

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    getElementById() is only a method (function) of document. IDs must be unique.

    Try this.
    Code:
    window.opener.document.getElementById("someid").value;
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


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
  •