Find the answer to your Linux question:
Results 1 to 7 of 7
I am building a site for a mate in HTML, and He wants images to open in new windows. I know this can be done by Code: <a href="path/to/image.jpg" target="_blank"> ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790

    HTML Help


    I am building a site for a mate in HTML, and He wants images to open in new windows. I know this can be done by
    Code:
    <a href="path/to/image.jpg" target="_blank">
    [img]path/to/thuimbnail.jpg[/img]</a>
    But is there a way to set the size of the new window to a set size?
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  2. #2
    Linux Engineer
    Join Date
    Jul 2003
    Location
    Farnborough, UK
    Posts
    1,305
    Sounds like a job for javascript to me. Dunno what the command is but if you can find a site that does what you want to do then just look in the status bar when you hover over a link.
    Lansbury's Lido

    thekiadriver on #linuxforums - fleetingly

  3. #3
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    ok! Cool! If anyone sees a site like this and remembers if u could post the address, or how it works?

    Thanx!
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer
    Join Date
    Jul 2003
    Location
    Farnborough, UK
    Posts
    1,305
    Lansbury's Lido

    thekiadriver on #linuxforums - fleetingly

  6. #5
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    script

    I always use this:
    Javascript function put it in the HTML HEAD
    Code:
    <script language="Javascript" type="text/javascript">
    <!--
    function openWindow&#40;path, windowname, w, h&#41; &#123;
    	// Name the Window, so the remote can target it - if required
    	self.name = "Master_Window"; 
    	
    	// determine center of screen
    	if &#40;screen.width&#41; &#123;
    		// IE
    		var xMax = screen.width;
    		var yMax = screen.height;
    	&#125; else &#123;
    		if &#40;window.outerWidth&#41; &#123;
    			// mozilla
    			var xMax = window.outerWidth;
    			var yMax = window.outerHeight;		
    		&#125; else &#123;
    			// Catch all
                var xMax = 640; 
    			var yMax=480;
    		&#125;
    	&#125;
    	
        var xOffset = &#40;xMax - w&#41;/2;
    	var yOffset = &#40;yMax - h&#41;/2;
    	
    	var opts = "scrollbars=no,resizable=no,width=" + w + ",height=" + h + ",left=" + xOffset + ",top=" + yOffset +",screenX=" + xOffset + ",screenY=" + yOffset;
    	// open it and maintain a var to it
    	var Child = window.open&#40;path, windowname, opts&#41;;
    &#125;
    //-->
    </script>
    Then use it like this

    Code:
    my link
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

  7. #6
    flw
    flw is offline
    Linux Engineer
    Join Date
    Mar 2003
    Location
    U.S.A.
    Posts
    1,025
    So what would be a solution for the browsers that are not javascript friendly?

    Is there a way to do what the users want in html or php?
    Dan

    \"Keep your friends close and your enemies even closer\" from The Art of War by Sun Tzu\"

  8. #7
    Linux User
    Join Date
    Jan 2003
    Location
    Cardiff, Wales
    Posts
    478

    no javascript

    in pure html all you can do is use _new or _blank as the target for the anchor.

    I suppose you could write a php function that tests $_SERVER['HTTP_USER_AGENT'] and then writes a different link depending on the answer but that could be complex.

    There is also a PHP function called get_browser. this returns an associate array detailing what the browser can support. However, to use this you need to setup a file called browsecap.ini - which I have not done.

    What browsers are you thinking of? general old browsers or text based ones like lynx?[/code]
    No trees were harmed during the creation of this message. Its made from a blend of elephant tusk and dolphin meat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •