473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Open an image file on clicking a link

how do we open an image file?

So far i had this done:

Expand|Select|Wrap|Line Numbers
  1. function clickLink()
  2. {
  3. var a = document.createElement('A');
  4. td.appendChild(a);
  5. a.href = '#';
  6. a.onclick = function(){ createImage(); };
  7. var img = document.createElement('IMG');
  8. img.src = '../windowfiles/bee.gif';
  9. a.appendChild(img);
  10. }
  11. function createImage()
  12. {
  13.  
  14. // im stuck here
  15.  
  16. }
  17.  
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?
Aug 2 '07 #1
4 1930
acoder
16,027 Expert Mod 8TB
What do you mean by "appear in another page"? Is this a new window or just a link to the image?

If it's just a link to the image, all you need to do is change the href attribute of the link to point to the image source.
Aug 2 '07 #2
acoder
16,027 Expert Mod 8TB
Changed the thread title. Please use good thread titles. Thanks.
Aug 2 '07 #3
Hi,
sorry for naming the thread wrongly.
but back to your question,
i want to create a function such that when the link "image" is clicked another window will open that displays the picture of bee.gif.

Please do help.
Thanks
Aug 3 '07 #4
acoder
16,027 Expert Mod 8TB
Hi,
sorry for naming the thread wrongly.
but back to your question,
i want to create a function such that when the link "image" is clicked another window will open that displays the picture of bee.gif.

Please do help.
Thanks
There is a very simple solution to this. Just use window.open and make the URL point to the image.
Aug 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Anna | last post by:
Hi all. I have a (hopefully) pretty simple question. I open a link in a new window: <a href="http://www.somewhere.com/some.hml"...
2
by: venkatesh | last post by:
Hi Members, I have used the below mentioned code to open a html page in a new browser. The window size is 200 x 300. In that browser, I've given code to open another browser of the same size....
15
by: Applebrown | last post by:
I've got a couple of errors on my site that I'm not sure how to fix. I'm using simple CSS for both text rollovers and my horizontal navbar, and here's what happens. First, the site: ...
7
by: Mark | last post by:
Hello; Here is what I wish to do: Click on a PDF link and have it open as a full screen window - not as a predetermined size. Sounds simple? I want to run the command from within the...
23
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div...
2
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
6
by: Karl | last post by:
Hi, Ok so on a given page I have 4 text links: see it in black see it in blue see it in red see it in green using the standard swap image behavior, clicking on one of the above links
7
by: Ben Amada | last post by:
Hi ... I have an HTML page containing a bunch of <alinks. Some of the links redirect the visitor to a page at a different website in a new browser window (target=_blank) and other links are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.