Click to See Complete Forum and Search --> : Can't populate Popup w/picture
dneese
03-31-2005, 05:00 PM
I'm a novice and I'm trying to accomplish what I thought to be a small task, so any help would be wonderful. Okay...here it goes. I'd like the user to be able to click on a thumbnail on my site which will then create a popup window with a larger picture and a close button. Thus far, I'm able to create the popup with close button, but can't seem to figure out how to populate the popup with a bigger imager of the thumbnail the user origianly clicked on. Here's my code:
[U]JavaScript portion[U/]
var link = "true";
function Replace(url) {
// if url empty, do nothing
if (link == "") return;
// otherwise, set to url
else window.location.href = url;
}
function popupgallery(PopURL, PopName) {
var newwingal = window.open( PopURL, PopName, "toolbar=0,location=0,scrollbars=1,resizable=1,width=500,height=450");
if(navigator.appName=="Netscape") newwin.focus();
}
[U]Picture.asp Portion[U/]
<html>
<head>
<title>Picture</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style TYPE="text/css">
<!--
body{
background : #fff;
margin: 0px 0px 0px 0px;
}
.imageborder2{
border: 2px solid #000;
}
-->
</style>
<Script LANGUAGE="JavaScript" TYPE="text/javascript" SRC="common/js.js"></Script>
</head>
<body>
<div align="center"><img class='imageborder2' src="http://www.mypage.com/pic1.jpg" vspace="30" hspace="30">
<form method="POST" action="">
<p align="center">
<input type="submit" onClick="self.close()" value="Close Window" name="B1">
</p>
</form>
</div>
</body>
</html>
If I hard code the image for the src I'm able to see that particular image. What am I doing wrong?
phpnovice
03-31-2005, 05:21 PM
Need to see what the user clicks on to invoke this stuff.
dneese
03-31-2005, 05:34 PM
Here's a link to the site I'm working with: http://www.forevermemoriesphotos.com/gallery/wedding/gready/
I'd like the popup to be populated with a larger (different) image. I'm at a stand still with this - I think my brain is going to explode :eek:
phpnovice
03-31-2005, 05:40 PM
You could have posted just this much and saved me having to search for it: ;)
<a href=javascript:popupgallery('http://www.forevermemoriesphotos.com/picture.asp?pic=gready-6-17.jpg','PopWin')>
So, change this:
src="http://www.mypage.com/pic1.jpg"
to this:
src="<%=Request.QueryString("pic")%>"
dneese
03-31-2005, 07:10 PM
Hi again...I tried replacing the code with your suggestion, but I'm still getting the same error plus it doesn't seem to like the vspace="30" hspace="30" following it. This is what what the line looks like now:
<div align="center"><img class='imageborder2' src="<%=Request.QueryString("pic")%>" vspace="30" hspace="30">
Yes, no...any other suggestions. Btw, thanks a bunch I REALLY appreciate your help! :)
phpnovice
03-31-2005, 08:05 PM
You never mentioned an error message before. What is it? As for vspace and hspace... What are they for?
dneese
03-31-2005, 08:16 PM
Hmm...the popup window shows a rectangle w/red X then this " vspace="30" hspace="30">. Before I updated the code it was just the rectangle w/red X. The vspace and hspace are just used for alignment/padding around the picture, so the image will be centered with white space around it.
phpnovice
04-01-2005, 12:29 AM
Hmm...the popup window shows a rectangle w/red X then this " vspace="30" hspace="30">
Then I would say that your site is not processing ASP code. I think the browser received the raw ASP code and, therefore, the ending %> is used by the browser as the end of the IMG tag. That is why your vspace and hspace are showing as text.
dneese
04-01-2005, 04:46 PM
Well, you hit it right on the money. The site doesn't support asp and told me to rewrite in php, so is there an easy way to do this, or perhaps you could point me to some good documentation. I never coded with php so this ought to be interesting. :(
phpnovice
04-01-2005, 05:43 PM
Yep, change this:
src="http://www.mypage.com/pic1.jpg"
to this:
src="<?=$_GET["pic"]?>"
dneese
04-01-2005, 06:39 PM
Well, I'm sorry to report I'm still having problems. I made the change and the line now looks like this:
<div align="center"><img class='imageborder2' src="<?=$_GET["pic"]?>">
However, I'm getting the picture placeholder with a "> on the side. So it appears that the site isn't processing this code either. Hmm...what's my next move?
phpnovice
04-01-2005, 07:27 PM
Did you name the document with the .php extension?
dneese
04-01-2005, 07:59 PM
Did you name the document with the .php extension?
Nope...sure in the heck didn't :o , but it's done now, updated one of my other pages to reflect the change and everything is working great :D Thank you SO much.
Now, if I could get a little advice? The majority of my pages were written as active server pages. Should I leave them the way they are, or, should I start converting them to php?
I work w/Dreamweaver and I'm planning on installing/setting up a PHP server on my PC, so I can see what's going on and make sure everything is working ok before I ftp it across.
Any suggestions?
phpnovice
04-01-2005, 08:32 PM
:confused: If the "majority of [your] pages [are] written as active server pages," then where are they running? I mean, if the ASP code I gave you at first wasn't working... What gives? Was that page missing the .asp extension, or what? :confused:
dneese
04-01-2005, 11:31 PM
Hmm...good question. Well, the majority of my pages are written in asp with the extension of .asp and they load fine. However, if the user clicks on something that is passing a variable it doesn't work. For example, popups and forms. So, I really don't have an answer. In theory if the server doesn't support asp then the majority of my site should be broken, right? :eek:
That's why I was wondering if I should start migrating to PHP. I don't really want to pursue it any further with my host in fear of loosing what I've already accomplished, especially with a language I never worked with before. What do you think? :confused:
phpnovice
04-02-2005, 10:16 AM
OK, so you have pages with the .asp extension and, at the moment, you think they are working just fine. Is that correct? Show me some of the ASP code in these pages that you think are working just fine. Conversely, place the following code in a page called test.asp on your site and place a link here to that page so that I can see if it works as it should.
<% @Language=VBScript %>
<%
Response.Write "<html>" & vbCrLf
Response.Write "<head>" & vbCrLf
Response.Write "<title>Test ASP Page</title>" & vbCrLf
Response.Write "</head>" & vbCrLf
Response.Write "<body>" & vbCrLf
Response.Write "<p>Test ASP Page</p>" & vbCrLf
Response.Write "</body>" & vbCrLf
Response.Write "</html>" & vbCrLf
%>