Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    I'm making an image open in a new window using javascript so I don't have to make loads of individual pages.

    So far close window is there and the image is in place, I was wonduring if there was a way of aligning the Close window text to the centre? obviously align comes in but where ? But where ? lol

    Code:
    <SCRIPT>
    function brit(words, img)
    {
    	win2 = window.open("","","width=320,height=404")
    	win2.document.write ('<img src="' + img + '" Alt="Britney Spears" />')
    	win2.document.write ("<BR><A HREF ='' onClick = 'self.close()'>Close Window</A>")
    }
    </SCRIPT>
    Here's the code for the bode..

    Code:
    <A HREF="#" onClick="brit('The kings website','pics/graphics/brit.jpg')">
    <img src="pics/graphics/brit_s.gif" 
    width="50" height="50" border="1"></a>
    ah thank you
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    Senior Member splufdaddy's Avatar
    Join Date
    Feb 2003
    Location
    Boston, MA
    Posts
    4,488
    Member #
    735
    Try this:
    Code:
    <SCRIPT>
    function brit(words, img)
    {
    	win2 = window.open("","","width=320,height=404")
    	win2.document.write ('<img src="' + img + '" Alt="Britney Spears" />')
    	win2.document.write ("<P align="center"><A HREF ='' onClick = 'self.close()'>Close Window</A></p>")
    }
    </SCRIPT>

  4. #3
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    lol now that isn't the answer i expected lol

    i expected loads of code lol but atleast i know now
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  5. #4
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    Now i've done that how would i go about adding a next and previous link to the popup window?

    So when you click next you get the next image ..
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  6. #5
    Senior Member splufdaddy's Avatar
    Join Date
    Feb 2003
    Location
    Boston, MA
    Posts
    4,488
    Member #
    735
    You can do this pretty easily, if you name your images 1.jpg, 2.jpg, etc.

    Here's something for you to play around with. I haven't done anything in javascript in a little while (and it's 2am) but here is a piece of simple code that I keep getting a JS error on. Firebird tells me I'm missing a parenthesis somewhere. I think you'll get the general idea, I'll try to perfect it tomorrow if it hasn't been perfected by then.
    Code:
    <html>
    <head>
    </head>
    <SCRIPT>
    
    function move(amt){
    num+='amt'
    document.theimage.src=num+".jpg"
    }
    
    function brit(words, img, num){
    
    	win2 = window.open("","","width=320,height=404")
    	win2.document.write ('<img src="' + num + '.jpg" Alt="Britney Spears" name="theimage" />')
    	win2.document.write ('<P align="center"><A HREF ='' onClick = 'self.close()'>Close Window
    </A><BR><A href="" onClick ='move(-1)'>left</a> <A href="" onClick = 'move(1)'>right</a></p>')
    }
    </SCRIPT>
    </head>
    <body>
    <A HREF="#" onClick="brit('The kings website','pics/graphics/brit.jpg','1')">test</a>
    </body>
    </html>


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com