/    Sign up×
Community /Pin to ProfileBookmark

passing a image

Instead of having 20 different html pages each loading a different image, can I instead use 1 page and pass each different image to that page to load? currently just using src=”image.jpg within different pages…

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JPnycFeb 23.2005 — More info is needed. You want them all to display at one time on one page? Or you just want 1 at a time to show? Or you just want to use one page to preload them?
Copy linkTweet thisAlerts:
@ranosbauthorFeb 23.2005 — The first page shows many (banknote)images. When one clicks on one of the images, it loads a new page with a larger size of that image. Instead of having 20 html pages each loading the different larger images, I wanted to use just one page where the larger image is passed to it to load...
Copy linkTweet thisAlerts:
@Warren86Feb 23.2005 — <HTML>

<Head>

<Script Language=JavaScript>

var largerView = "";
var winToggle = false;

function openFullSize(Pix){

if (winToggle == true){largerView.close()}
document.getElementById('nullIMG').src = Pix;
wStr = nullIMG.width;
offsetW = wStr;
wStr = wStr+20;
wStr = "width="+wStr;
hStr = nullIMG.height;
offsetH = hStr;
hStr = hStr+20;
hStr = "height="+hStr;
lStr = (screen.width-50-offsetW)/2;
lStr = "left="+lStr;
tStr = (screen.availHeight-50-offsetH)/2;
tStr = "top="+tStr;
largerView = window.open(Pix,"FullSize","toolbar=0,status=0, "+tStr+","+lStr+","+wStr+","+hStr+" ");
largerView.document.images[0].alt = "This is a description";
winToggle = true;
}

function buildSupport(){

styleStr = "<Style> .placeHolder {Position:Absolute;Top:-2000}</Style>";
divStr = "<Div class=placeHolder><IMG Src=Null ID=nullIMG></Div>"
document.write(styleStr);
document.write(divStr);
}

buildSupport();

window.onunload=function(){

if (winToggle && !largerView.closed){largerView.close()}
}

</Script>

</Head>

<Body>

<center>

<H3>Automatic centering and sizing of popup window</h3>

<Img Src='Any.jpg' width=200 height=200 onclick="openFullSize(this.src)"></a>

</center>

</Body>

</HTML>
Copy linkTweet thisAlerts:
@ranosbauthorFeb 24.2005 — That works great with one image. How do I make it so the displayed image is image1 and the onclick image is image2? This modification doesnt work for some reason on the first click...

It apprears it needs to preload to work right..

<Img Src='image1.jpg' width=200 height=83

onclick="openFullSize('image2.jpg')"></a>

So by adding this it works!

<script>

<!-- Preload onclick image so function openFullSize works

image01= new Image(42,42)

image01.src="image2.jpg"

//-->

</script>
×

Success!

Help @ranosb 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.9,
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,
)...