473,320 Members | 1,848 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,320 software developers and data experts.

How to put image in a layer through Javascript

Hello Guys,

Actually i m doing like when one user selects the particular picture and press enter then the function of javascript called .function is shown below.
Expand|Select|Wrap|Line Numbers
  1. function select()
  2. {
  3.     document.formname.layername.document.write("<img src='image.jpg' width='400' height='400'>");
  4. }
But it gives me error of like. document.formname.layername is null or no object defined.

So wht should i do put image in layer.please help me out. thx
Sep 10 '07 #1
2 1317
acoder
16,027 Expert Mod 8TB
You can't use document.write after the page has loaded.

Use innerHTML instead (for an easy way). The layer will probably not be a child of the form, so you'll probably need to access it in another way. Give the layer (div) an id and use document.getElementById(id) to access the layer.

If you can't solve it, post your HTML code.
Sep 10 '07 #2
pbmods
5,821 Expert 4TB
Heya, Dhaval.

Please use CODE tags when posting source code:

[CODE=javascript]
JavaScript code goes here.
[/CODE]

This is not the first time I've had to ask.
Sep 11 '07 #3

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

Similar topics

3
by: Vandana Rola | last post by:
Hi Everyone, Description: I have created flash cards using html layers, jpegs, and javascript. The way I designed it is, I have words and their descriptions (meaning) as jpeg files. Each word...
5
by: Milagro | last post by:
Hi, I'm a perl/C programmer but a Javascript problem has been dumped into my lap. A client of mine has a freeware javascript on their site which shows a series of pictures on a web page in a...
5
by: Jay | last post by:
Difficult to explain but.... I have a form. Inside the form is a table (2 columns). 1st column has text. Click on the text and a hidden div appears in the 2nd column and contains a textarea....
4
by: Troy | last post by:
Hi all, Im a little new to ASP.NET. I'm looking to create an image viewer that zooms in, pretty common. But I need to draw a box on the 1:1 scale image and 'zoom in' on another picture box. ...
0
by: Tim::.. | last post by:
Please, please, please help!!! I have a datagrid that displays a list of contacts on our intranet site using the ActiveDirectory as it's main Data Source. I want to be able to show an image of...
18
by: Andrew Christiansen | last post by:
Hey all. The images I create in photoshop with semi-transparent pixels (for instance in Photoshop text with a dropshadow with a transparent canvas) I've been saving in PNG format and then using...
2
by: ashoknepc | last post by:
i am learning asp.net ajax, i want to show thumbnails of images on the page when i mouseover the thumbnail it should get enlarged into a layer above it. and this layer should get hide on...
6
by: Seth Illgard | last post by:
Hi, Im writting a custom CMS and everything looks great, except when I see the results in IE. What im trying to do is: *Have an image in a layer (or relative positioned, or just margined). The...
6
by: sagarlotiya | last post by:
Hi I have made one javascript which allows me to add note on image using css and javascript. Every thing works fine. But following problme occurs. I want to display allthe notes on image when we...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.