SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    window.open problem help urgent

    Hello Guys

    I am using a javascript function to open the window.The window is opening
    correctly in IE 7,Firefox.But it is not opening in IE 6.
    The code I have used is

    Code JavaScript:
    function OpenPopUp(imageid)
    {		
    	var iWidth=820;
    	var iHeight=620;
    	var myURL="imagepopup.php?image_id="+imageid;
    	posLeft = (screen.width - iWidth)/2;
            posTop = (screen.height - iHeight)/2; 	            window.open(myURL,"_blank","toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=820,height=620,left="+posLeft+",top="+posTop);
    }

    Please help me out.Its urgent.
    The html code I used is
    HTML Code:
    <a href="#" onclick="javascript:OpenPopUp(<?=$imgAid?>);">Open Image</a>
    Your help will be highly appriciated.

    Thanks,
    Kanchan
    Barbara

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code is ok. It works for me in IE6 when not using php variable for imageid. Maybe try to change this:
    Code JavaScript:
    <a href="#" onclick="OpenPopUp('<?=$imgAid?>'); return false">Open Image</a>
    You don't need to put 'javascript:' in onclick because it already expect js code. Return false is needed because anchor # will make your page jump to top. Return false stop this. And also put php variable between apostrophes.

  3. #3
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    I have tried for '<?=$imgAid?>' but still the popup is opening the
    pop up but the image is not displaying.

    Also I have tried to send the direct url to the function.but the result is same.

    Code JavaScript:
    function OpenPopUp(myURL)
    {      
        var iWidth=820;
        var iHeight=620;
        posLeft = (screen.width - iWidth)/2;
            posTop = (screen.height - iHeight)/2;               window.open(myURL,"_blank","toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,r esizable=yes,width=820,height=620,left="+posLeft+",top="+posTop);
    }
    Barbara

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand what the problem is? I though that it was in opening popup, not in displaying the image. Opening popup should work. See if popup blocker is turn on in your IE6. I don't see any code in your post which is for displaying image.


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
  •