469,613 Members | 1,503 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

Specifying image source dynamically

Hi,
I am using HTML,Javascript. I m trying to specify source path for a dynamically created element.But its not displaying the image.Please help me.
I m using the following code:


Expand|Select|Wrap|Line Numbers
  1. var row1td7=document.createElement('TD');
  2. var row1td7btn=document.createElement('input');
  3. row1td7btn.setAttribute('type','image','id','Del'+i);
  4. row1td7btn.src="test image\del.jpeg";
  5. row1.appendChild(row1td7);
  6. tbody.appendChild(row1);
  7.  
I m using the above code to insert a button with image in a dynamically created table.

Thanks
daitasri
Mar 19 '08 #1
2 1164
theS70RM
107 100+
Hi,
I am using HTML,Javascript. I m trying to specify source path for a dynamically created element.But its not displaying the image.Please help me.
I m using the following code:


var row1td7=document.createElement('TD');
var row1td7btn=document.createElement('input');
row1td7btn.setAttribute('type','image','id','Del'+ i);
row1td7btn.src="test image\del.jpeg";
row1.appendChild(row1td7);
tbody.appendChild(row1);

I m using the above code to insert a button with image in a dynamically created table.

Thanks
daitasri

I'd start by checking (and double checking) your image path. I know its just a test, but does it really have a space in it?

If not then maybe you can post a link to a fuller example.

Cheers
Mar 19 '08 #2
acoder
16,027 Expert Mod 8TB
Two problems I can see.

setAttribute only has two parameters. Separate the type and id settings.

You've used a backslash for the image path. Use a forward slash instead.
Mar 20 '08 #3

Post your reply

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

Similar topics

3 posts views Thread by Andy | last post: by
2 posts views Thread by Olav Tollefsen | last post: by
2 posts views Thread by Robson Carvalho Machado | last post: by
reply views Thread by Iain | last post: by
3 posts views Thread by krzysztof.murkowski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.