SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Targetting windows opened by JS

    Take the following (simplified) example:
    <form name="testform" method="post" action="test.asp">
    <input type="hidden" name="field" value="whatever">
    <input type="button" value="go post" onclick="goPost2()">
    </form>

    <script type="text/javascript">
    function goPost()
    {
    myWin = window.open("page.htm","myWin","width=300")
    document.testform.target = "myWin";
    document.testform.submit();
    }
    </script>

    The code is opening a (javascript) window and then setting the target of the form to that new window. Great and it works on 48 out of the 50 machines here BUT, infuriatingly, it refuses to work on two IE machines.

    The form submit targets a new (like a _blank) window. I've tried everything including adding a delay (up to 8 seconds!) after the open. I've written the code a thousand different ways (without 'myWin =' etc, using a normal submit button and target attribute). I've installed IE5.0 SP2 without luck, upgraded to IE5.5 SP2 and it still didn't work. IE6 nada. The script engine is 5.6 (latest version) and yet it still refuses to target the window opened by script.

    The window knows that it's name is myWin as I've used:
    document.write(window.self.name) in page.htm.

    Please help me before I pull it all my hair, give myself concussion and damage the wall.

    Yours desparingly

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uh, I tested something like this a while back...but I just used the HTML target attribute;

    <form name="testform" method="post" action="test.asp" target="myWin">

    And remove the JS line that attempts to set the target.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Member
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've had a similar thread running at WebmasterWorld and, as I say, I've tried everything...

    Here's others suggestions on that board (none have worked)
    http://www.webmasterworld.com/forum21/3397.htm

    Thanks for trying - anybody else got any ideas?

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya, blow up those two machines and proclaim to your boss that you have 100% compatibility.

    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •