SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    south london
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    newbie needs pop up help

    hi guys and technical girls

    i need a bit of help here, javascript is like japanese to me, i found this code on a site and the pop up is perfect, i have tried to get my image in but i cant seem to get it to display in the pop up, can anyone help, here is the code:

    <SCRIPT TYPE='text/javascript'>
    <!--
    function popup(width,height){
    if(window.innerWidth){
    LeftPosition =(window.innerWidth-width)/2;
    TopPosition =((window.innerHeight-height)/4)-50;
    }
    else{
    LeftPosition =(parseInt(window.screen.width)- width)/2;
    TopPosition=((parseInt(window.screen.height)-height)/2)-50;
    }
    attr = 'resizable=no,scrollbars=yes,width=' + width + ',height=' +
    height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
    TopPosition + '';
    popWin=open('', 'new_window', attr);
    popWin.document.write('<head><title>Test Popup</title></head>');
    popWin.document.write('<body><div align=center>');
    popWin.document.write('<b>This is a test popup window</b><br><br>');
    popWin.document.write('Content goes here<br>');
    popWin.document.write('Content goes here<br>');
    popWin.document.write('Content goes here<br>');
    popWin.document.write('</div></body></html>');
    }
    //-->
    </SCRIPT>
    </head>

    <body>
    <a href="javascriptopup(400,200);">Generate popup</a>

    cheers - much apprieciated

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,478
    Mentioned
    162 Post(s)
    Tagged
    1 Thread(s)

    no img tag

    You don't have an img tag in your document.write lines.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    south london
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i know i dont have an img tag, thats because i dont know where to put it, i have tried it in different places with it complete and with bits missing but cant seem to get it working - you didnt think i just copied the code and expected it to show my image!

    can anyone put me in the right direction as to where i put the image tag.
    thank you

  4. #4
    SitePoint Enthusiast RSBomber's Avatar
    Join Date
    Oct 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look at the following article. I think this might be a better approach.

    www.openhosting.co.uk/articles/webdev/5918/

    It would be easier for you to develop your popups as separate HTML files and call them using this technique... plus it's a whole lot easier to maintain.

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,478
    Mentioned
    162 Post(s)
    Tagged
    1 Thread(s)

    img tag

    No offense was meant. It's just that you didn't mention whether you had tried:
    • img tag using relative path to the image from the location of the pop-up
    • img tag using relative path to the image from the location of the parent
    • img tag using absolute path to the image
    or show any in the snippet.


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
  •