/    Sign up×
Community /Pin to ProfileBookmark

how do we open an image file?

So far i had this done:

function clickLink()
{
var a = document.createElement(‘A’);
td.appendChild(a);
a.href = ‘#’;
a.onclick = function(){ createImage(); };
var img = document.createElement(‘IMG’);
img.src = ‘../windowfiles/bee.gif’;
a.appendChild(img);
}
function createImage()
{

// im stuck here

}

i want the function to work such that when the link “Image” in my html page is clicked the image “bee.gif” will appear in another page.

how do i go about this?

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@DetectAug 02.2007 — A popup window or another part of the page?
Copy linkTweet thisAlerts:
@bimeldipauthorAug 03.2007 — in another part of the page. But if we were to open it in a pop up window how does that happen too?

Thanks for the help...
Copy linkTweet thisAlerts:
@DetectAug 03.2007 — Your code could be correct...just make sure you defined td. For example, put a div where you want the image to show up with id="blah" and in function clickLink() do...td = document.getElementById("blah")

use window.open for popup window
×

Success!

Help @bimeldip 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.29,
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,
)...