/    Sign up×
Community /Pin to ProfileBookmark

Image Popup Code? Novice here…

Hello all!

For some reason, I can’t make heads nor tails out of some script, and I am no scripter by any stretch of the imagination. I went to htmlgoodies (ok, quit rolling your eyes and making puke noises!) and grabbed the script for a popup window. But there’s no info as to what goes where. ?

Here’s the deal – I want to put a “view image” button on a page under a .jpg. Clicking the button (which I’d like to rename as “additional images” if possible) would open a window with a larger .jpg, as well as the “close window” button. Let’s call the image “amy.jpg” When I place this script where I want the “View Images” button, the button appears, but when clicked, nothing pops up. I want to avoid a shopper clicking the image of the item for sale, having a whole new IE window open, then having to click “back” or “return to blah blah” link. WIth the popups, a person can have 3 or 4 images up, and compare them at the same time. I want things to be fast, easy, clean.

Any and all help greatly appreciated! ?

Here’s the script:

<SCRIPT language=JavaScript>

var width,height
var image,ext
var cond1,cond2
function transferview(image,width,height) {
if (width==0) cond1=” “
else cond1=”width=”+(width+20)+””;
if (height==0) {cond2=” “};
else {cond2=”height=”+(height+70)+””};

var s1 =”<TITLE>…</TITLE>”
var s15=””
var s2 =”<CENTER><IMG SRC='”+image+”‘ BORDER=0>”
var s3 =”<FORM><INPUT TYPE=’BUTTON’ VALUE=’Close Window'”+ ” onClick=’self.close()’>”
var s4 =”</FORM></CENTER>”

ImageWindow=window.open(“”, “newwin”+width,”toolbar=no,scrollbars=”+scroll+”,menubar=no,”+cond1+”,”+cond2);
ImageWindow.document.write(s1+s15+s2+s3+s4)
ImageWindow.document.close()
}
</SCRIPT>

<FORM><INPUT onclick=”javascript:transferview(‘test.gif’,200,300)” type=button value=”View Image”> </FORM></a>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyJul 16.2005 — do you have heaps of images that require this, other wise there is an easier way, this script is if you have like lots and dont want to modify code for every page. But if you want to fix this one i suggest removing the line:
[CODE]ImageWindow.document.close()[/CODE] and give it a shot?
Copy linkTweet thisAlerts:
@TexasGalauthorJul 16.2005 — Tried it, the window popped up, but then the "close window" button was disabled.

Also, if I try to pop up multiple windows - say you have 5 items a customer is interested in, and they want to line them up to compare them - it doesn't. One window stays up, and that's it.

Is there an easier way, or should I just link the image to a new html page - and put all the info, pay here button, etc. on it? Seems difficult and time consuming to the shopper.

Thank you though, appreciate it!
Copy linkTweet thisAlerts:
@bathurst_guyJul 16.2005 — There will only be one open because they all are given the same name.
[CODE]<SCRIPT language=JavaScript>

var width,height
var image,ext
var cond1,cond2
function transferview(image,width,height) {
if (width==0) cond1=" "
else cond1="width="+(width+20)+"";
if (height==0) {cond2=" "};
else {cond2="height="+(height+70)+""};

var s1 ="<TITLE>...</TITLE>"
var s15=""
var s2 ="<CENTER><IMG SRC='"+image+"' BORDER=0>"
var s3 ="<FORM><INPUT TYPE='BUTTON' VALUE='Close Window'"+ " onClick='document.close()'>"
var s4 ="</FORM></CENTER>"

ImageWindow=window.open("","+image+"+width+,"toolbar=no,scrollbars="+scroll+",menubar=no,"+cond1+","+cond2);
ImageWindow.document.write(s1+s15+s2+s3+s4)
}
</SCRIPT>

<FORM><INPUT onclick="javascript:transferview('test.gif',200,300)" type=button value="View Image"> </FORM></a>[/CODE]
Copy linkTweet thisAlerts:
@Jonny_LangJul 16.2005 — .....
×

Success!

Help @TexasGal spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...