SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pop up windows in JS with no margin..

    I am using popup windows.. to display some images, but I can't seem to figure out how to get rid of the left and top margins in the windows.. I am sure this is pretty simple. Can someone help me out ?



    Thanks

    CHuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  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)
    for sum reason i could not pass the style to the popup, but this works anyway.

    PHP Code:
    <script>
    window.open ('','','');
    x.document.write ('hello<script>document.body.style.margin = \'0px 0px 0px 0px;\';</script'+'>');
    </script> 

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there not a way to put style in the javascript popup window? Or is there a way that I use a template to load the images into?

    If I where to make an html file for every pop up .. I would have to make over a 100 html pages to hold one image each.


    Thanks

    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  4. #4
    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)
    look up

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could I get a wee bit more help?

    this is the head:

    Code:
    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features)
    { //v2.0
      window.open(theURL,winName,features);
    }
    //-->
    </script>

    and the actual link

    Code:
    <a href="#"><img style="border:0"src="images/people/thmnails/image002.jpg" width="120" height="89"  onMouseDown="MM_openBrWindow('images/people/images/image002.jpg','cconway.com -Photos','width=480,height=360')"></a>

    I am still learning JS...


    Thanks

    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am still having problems with this JavaScript popup window .. and the margins .. anyone have anymore idea's on it?

    Thanks

    Chuck
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  7. #7
    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)
    are you linking to your own page or a blank page

    if its a blank page use this instead of you top function

    PHP Code:
    <script>

    <
    script language="JavaScript">
    <!--
    function 
    MM_openBrWindow(theURL,winName,features)
    //v2.0
      
    window.open(theURL,winName,features);
      
    x.document;
      
    y.write('<script>');
      
    y.write('document.body.style.margin = \'0px 0px 0px 0px;\';');
      
    y.write('</scr' 'ipt>');

    }
    //-->
    </script> 
    other wise use css in the file that your linking to so say you want test.html to have no margins then use css in the head of the page like this

    PHP Code:
    <style>
        
    body
        
    {
            
    margin 0px0px0px0px;
        }
    </
    style
    Last edited by Andrew-J2000; Apr 23, 2002 at 11:02.

  8. #8
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am creating a photo gallery with thumbnails .. when you click on an image it popups in a window that fits the image snuggly. But IE Netscape 6 and Mozilla are kind enough to put a left and top margin in their blank windows .. which is causeing me a lot of pain.

    I tried your script out .. and I cant get it to work .. I am not sure why.. so I am posting the link to the page with the problem .. if you have time .. could you look at it .. if not .. later tonight I am going to write a java program that will create the html files for me..



    Thanks


    Chuck

    cconway.com/v4/nature.htm
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  9. #9
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take a look at this page:
    http://www.clockworkdesign.net/

    The designer uses a script called gallerypics.js. It opens a new window and dynamically writes HTML to "create" this new window. Part of the HTML includes the body tag with no margins. I realize this might be overkill for what you need but this is the best "pop-up" window script (made for an image) that I've ever seen. The script authors site is www.bugimus.com but I could not find the script on that site.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  10. #10
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your a god Creole! That works perfectly ... I have spend hours trying to learn JS enough to write a script that would work ..


    Thanks

    Chuck

    P.S

    Thanks, Andrew-J2000 for all your help ..
    Last edited by Chuckie; Apr 23, 2002 at 14:52.
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  11. #11
    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)
    where you have all them divs you might want to think about using this instead

    PHP Code:

    <script language="JavaScript">
    <!--
    function 
    openWin(urlwh)
    {
      
    img_dir'images/nature/images/';
      
    window.open(img_dir+url'''witdth='+w+'height='+h);
    }
    //-->
    </script>
                <script>
                    for (i=0,j=15;i<=j;i++)
                    {
                        if (i<10) document.write ('<div class="pics"><a href="#"><img style="border:0" src="image00'+i+'.jpg" width="120" height="89"  onMouseDown="openWin(\'image00'+i+'.jpg\',480,360)"></a></div>');
                        else      document.write ('<div class="pics"><a href="#"><img style="border:0" src="image0.jpg" width="120" height="89"  onMouseDown="openWin(\'image0'+i+'.jpg\',480,360)"></a></div>');
                    }
                </script> 


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
  •