Javascript popup window examples1/2/2024 ![]() This could should be fairly easy to modify for use with a database, for example, which holds references to all these images. Since the PHP is processed on the server-side, the code is spit out as normal HTML, allowing JavaScript to grab the height/width attributes as before and add their 50 pixels onto it. I’ve echoed that info in the middle of the IMG tag… What’s happened here is that PHP’s GetImageSize() function has grabbed the data I mentioned earlier - and as before, the 4th element (numbered 3, though…) contains the HTML attributes to save us all some time. name="picture" border="0" alt="ALT Text Here"> Here’s some code to try (see it in action: JavaScript/PHP Image Test)… ![]() The function uses that image name to grab the height and width properties (the SRC property as well for later use) specified in the picture through normal HTML attributes, adds 50 pixels to each them (customize that as you like), and opens the image’s SRC in a new window with the height and width expanded however many pixels you have set for each attribute.Ĭool, eh? If you’d like me to modify it let me know. ![]() If you were to use this many times for a number of images on one page, it would require a seperate name each time. This argument is the name the picture has. When the image/link is clicked, the function is triggered - as you can see, an argument is passed to it. Simply customize the image SRC value and the height and width, ALT Text, etc. Window.open(SRC,'popup','width=' + width + ',height=' + height + ',menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=no,top=50,left=50') Īs you can see, the function requires almost not customization. I came up with something for ya’ (I need to learn JS from example anyway, so I took pleasure in this): You would obviously need to have the opup slightly bigger than the image to fit in the border and the close link So for example if you image was called phil-man.gif you could link to it using: ![]() Here is an alternative way you could do it:Īnd then you would like to the image using: All rights reserved.I dont think it is possible for javascript to measure the dimensions of an image. Model dialog (set background browser client area to gray) Yui.zip( 3,714 k) Related examples in the same category 1. Aliquam ac massa non velit posuere facilisis. Praesent ut velit vel mi feugiat posuere. Quisque metus augue, ornare scelerisque, tempor eget, euismod porttitor, dui. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque adipiscing, mi in dapibus imperdiet, lacus diam auctor ligula, eu interdum nibh nibh in ligula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut feugiat, sem non hendrerit convallis, nisi lectus laoreet mauris, eget nonummy est eros a ligula. Aliquam risus tellus, volutpat vel, tincidunt quis, tristique et, justo. Pellentesque vel tellus quis pede congue rutrum. This is a
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |