SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Sunset Strip, LA
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Positioning a pop up window.

    I have done a search, coming up with this one closed thread: http://www.sitepointforums.com/showt...Photo+Display.

    My question is very similar, but specifically this: I'm using DreamWeaver MX to construct site, and unfortunately know little about Javascript. I would like to position all my pop ups in upper left corner of viewer's monitor, as did the originator of the above thread.

    In that thread, W. Luke supplied the following javascript:

    <script>function openWindow (location){x = 0;y= 0;newWin = open(location,"miniwindow", "toolbar=0,location=0,directories=0,status=0,menubar=0," +"scrollbars=0,resizable=0,width=665,height=505");newWin.moveTo (x,y);}</script><A HREF="javascript:void(0)" ONCLICK="openWindow('Your File location here')"> <IMG SRC="photos/thumbnail.jpg" WIDTH=100 HEIGHT=088 BORDER=NO></A>

    Can someone help regarding using the positioning function above, but discarding the opening function, as Dreamweaver already supplies such a script, and I'd like to continue using it as I add more pages.

    Here is the script from a sample page [http://www.rivercardz.com/Photos-Mai...Track82802.htm] of mine:

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

    Where can I put the positioning function that W. Luke supplied in this script?

    Thanks for any help provided.
    rivercardZ

  2. #2
    ********* User Jmi's Avatar
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A direct copy and paste, I yield this

    Code:
    <script type='text/javascript'>
    <!--
    function MM_openBrWindow(theURL,winName,features) 
    { 
    	x = 0;
    	y = 0;
    	newWin = open(theURL ,winName, features);
    	newWin.moveTo (x,y);
    }
    //-->
    </script>
    Signature not found.

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Sunset Strip, LA
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried Jmi's suggestion. Did a test on one of my pages [http://www.rivercardz.com/Photos-Mai...Drive81102.htm], which was originally built from a template. To edit the javascript as suggested, I had to dissassociate the individual page from the template. I'm using DreamWeaver MX, keep in mind.

    Then I could cut and paste Jmi's text.

    Unfortunately, after all that, the page displayed as a blank white page. No text, no images, nothing. (I just fixed it by rebuilding the entire page from the template.)

    I suspect the problem with the display stemmed from the dissassociation from the template, and not Jmi's script.

    But now I don't know what to do. I could try cutting and pasting javascript in the template itself, and updating all "daughter" pages, but am too fearful of messing up my whole site.

    This is one of those "grrrrr" moments that happen too often...
    rivercardZ

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Sunset Strip, LA
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another thought: could I, while keeping the javascript Dreamweaver puts in to open a browser window, add additional javascript text just below it?

    Perhaps simply cut and paste Jmi's entire text, pasting it directly below Dreamweaver's, between the head tags, so that it would look like this:

    ***Start sample***

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

    <script type='text/javascript'>
    <!--
    function MM_openBrWindow(theURL,winName,features)
    {
    x = 0;
    y = 0;
    newWin = open(theURL ,winName, features);
    newWin.moveTo (x,y);
    }
    //-->
    </script>

    <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
    </head>

    **End sample text**

    Since I don't know javascript well, would this mess up the page again?
    rivercardZ

  5. #5
    ********* User Jmi's Avatar
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh my...
    sorry, let me explain a little

    Code:
    function MM_openBrWindow(theURL,winName,features)
    theURL - the path eg. "http://www.yahoo.com" or "myscript.asp"

    winName - just a title on the window

    feature - those "toolbar=0,location=0,directories=0,status=0,
    menubar=0," +"scrollbars=0,resizable=0,width=665,
    height=505"


    To call it

    Code:
    <script TYPE='text/javascript'>
    <!--
    	function MM_openBrWindow(theURL, winName, features) 
    	{ 
    		x = 0;
    		y = 0;
    		newWin = open(theURL ,winName, features);
    		newWin.moveTo (x,y);
    	}
    //-->
    </script>
    
    <HTML>
    <BODY>
    <form name='frmTest' id='frmTest' method='post'>
    <input name='txtClick' 
            type='button' 
            value='open' 
            onclick='MM_openBrWindow("http://www.yahoo.com", "DateTest", "");' />
    </form>
    </BODY>
    </HTML>
    press the button.

    replace the http://www.yahoo.com with the name of the file you want to open, coz I dun think it will allow you to open a yahoo.com.. (I got a access denied)
    Last edited by Jmi; Feb 18, 2003 at 18:14.
    Signature not found.

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Sunset Strip, LA
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. I will give it a try in next few days, but must now leave the computer for a while to attend to other biz. I will post here again to follow up.
    rivercardZ


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
  •