Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2007, 03:00 PM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default image popper-need help

I am trying to make an HTML document, where there is an image, and a button below it. If you click the button, a new window will pop up and will display the image, along with descriptive text below the image. I want to do this using JavaScript since it would be too hard to do this in plain HTML since I would have too many HTML documents.

Here is the code for the thing:
Code:
<HTML>
<HEAD>
<TITLE>R32 Pictures</TITLE>
<SCRIPT language="JavaScript" src="poppic.js">
</SCRIPT>
</HEAD>
<BODY>
<LINK rel="stylesheet" href="http://error46146.awardspace.com/style.css">
<PTITLE>R32 Pictures:</PTITLE><BR>
Below are some of my best R32 pictures. To view a picture, please click on the button under the thumbnail.<BR>
<TABLE border="0">
<TR>
<TD><IMG src="r32-1.jpeg" width="200" height="150.5"><BR>R32 3754 E train at Roosevelt Avenue</TD>
<TD><IMG src="r32-2.jpeg" width="200" height="150.5"><BR>R32 3807 E train at West 4th Street</TD>
<TD><IMG src="r32-3.jpeg" width="200" height="150.5"><BR>R32 E train leaving 14th Street</TD>
</TR>
<TR>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,1,'R32 3754 E train at Roosevelt Avenue')"></TD>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,2,'R32 3807 at West 4th Street')"></TD>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,3,'R32 E train leaving 14th Street')"></TD>
</TR>
<TR>
<TD><IMG src="r32-4.jpeg" width="200" height="150.5"><BR>R32 3498 E train at West 4th Street</TD>
<TD><IMG src="r32-5.jpeg" width="200" height="150.5"><BR>R32 3745 E train at Roosevelt Avenue</TD>
<TD><IMG src="r32-6.jpeg" width="200" height="150.5"><BR>R32 3913 A train entering Rockaway Blvd</TD>
</TR>
<TR>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,4,'R32 3498 E train at West 4th Street')"></TD>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,5,'R32 3475 E train at Roosevelt Avenue')"></TD>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,6,'R32 3913 A train entering Rockaway Blvd')"></TD>
</TR>
<TR>
<TD><IMG src="r32-7.jpeg" width="200" height="150.5"><BR>R32 3373 E train at Sutphin Blvd</TD>
<TD><IMG src="r32-8.jpeg" width="200" height="150.5"><BR>R32 3800 E train at 75th Avenue</TD>
</TR>
<TR>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,7,'R32 3373 at Sutphin Blvd')"></TD>
<TD><INPUT type="button" value="View Picture" onClick="popapic(32,8,'R32 3800 at 75th Avenue')"></TD>
</TR>
</TABLE><BR>
<A HREF="r32-i1.jpeg">R32 Interior pic-click here</A><BR><BR>
</BODY>
</HTML>
and here is the code in the poppic.js file:
Code:
function popapic(car,locy,descrip) {
    window.open("r"+car+"-"+locy+".jpeg",picwin,"height=700,width=900,resize=yes);
    picwin.document.write(descrip);
}
I keep getting an error when i click one of the buttons that says function popapic is not defined on Firefox. I have not tested it in IE yet.
I don't know why i get this error since clearly popapic is defined in the JS file.
Does anyone know what is wrong?
 
Old August 15th, 2007, 04:14 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here try this script this a nice one and easy to implement

http://www.huddletogether.com/projects/lightbox2/

__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.
 
Old August 15th, 2007, 04:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

That is one kewl script :)

 
Old August 15th, 2007, 08:33 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow, that is one nice script!! Thanks!

Forget all that confusing Javascript stuff, I will use that from now on..lol
 
Old August 15th, 2007, 06:51 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

great link...

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
Copy kodak image edit control's image to clipboard vishwanathduddilla Visual Studio 2005 0 November 3rd, 2008 10:10 AM
set image on <asp:Image> stored in DataBase myself.panku ASP.NET 2.0 Professional 1 August 11th, 2008 10:41 AM
Document Image Processing (DIP) - changing image f ALcom Access 0 March 27th, 2006 06:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.