473,402 Members | 2,061 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,402 software developers and data experts.

Image Object help displaying images

praclarush
I need to take an image that was in a Array object image and have it display in a table. this is for a item list the table has four columns one for the image, one for a description, one for a price, and the last for the amount of the item.
I've looked on the internet for help but all I find is how to do image switches for links and slideshows. nothing on how to just pull the image from the array and then print it.
this is the image array Im using, all it will display is the broken image icon.
Expand|Select|Wrap|Line Numbers
  1.     //declare image array
  2.     var product = new Array();
  3.     product[0] = new Image();
  4.     product[1] = new Image();
  5.     product[2] = new Image();
  6.     product[3] = new Image();
  7.     product[4] = new Image();
  8.     product[5] = new Image();
  9.     product[6] = new Image();
  10.     product[7] = new Image();
  11.     product[8] = new Image();
  12.     product[9] = new Image();
  13.     //populate image array
  14.     product[0].src = "images/colorpads.jpg";
  15.     product[1].src = "images/glue.jpg";
  16.     product[2].src = "images/highlighter.jpg";
  17.     product[3].src = "images/notecard.jpg";
  18.     product[4].src = "images/pad.jpg";
  19.     product[5].src = "images/pen.jpg";
  20.     product[7].src = "images/pencil.jpg";
  21.     product[8].src = "images/permmarkers.jpg";
  22.     product[9].src = "images/scissors.jpg";
  23.  
and here is the code that i tried to use
Expand|Select|Wrap|Line Numbers
  1. document.write("<td class='product_image'>");
  2. document.write("<img id='"+i+"'/>");
  3. document.images[i].src = product[i];
  4. document.write("</td>")
  5.  
i also tried it like this but it also didn't work
Expand|Select|Wrap|Line Numbers
  1. document.image("<img src="+product[i]+"/>"
  2.  
html wise its just a script in the body that calls a function to performs this and some other items that I already have working

Any help would be nice,
praclarush
Nov 11 '07 #1
2 1884
Dasty
101 Expert 100+
I need to take an image that was in a Array object image and have it display in a table. this is for a item list the table has four columns one for the image, one for a description, one for a price, and the last for the amount of the item.
I've looked on the internet for help but all I find is how to do image switches for links and slideshows. nothing on how to just pull the image from the array and then print it.
this is the image array Im using, all it will display is the broken image icon.
Expand|Select|Wrap|Line Numbers
  1.     //declare image array
  2.     var product = new Array();
  3.     product[0] = new Image();
  4.     product[1] = new Image();
  5.     product[2] = new Image();
  6.     product[3] = new Image();
  7.     product[4] = new Image();
  8.     product[5] = new Image();
  9.     product[6] = new Image();
  10.     product[7] = new Image();
  11.     product[8] = new Image();
  12.     product[9] = new Image();
  13.     //populate image array
  14.     product[0].src = "images/colorpads.jpg";
  15.     product[1].src = "images/glue.jpg";
  16.     product[2].src = "images/highlighter.jpg";
  17.     product[3].src = "images/notecard.jpg";
  18.     product[4].src = "images/pad.jpg";
  19.     product[5].src = "images/pen.jpg";
  20.     product[7].src = "images/pencil.jpg";
  21.     product[8].src = "images/permmarkers.jpg";
  22.     product[9].src = "images/scissors.jpg";
  23.  
and here is the code that i tried to use
Expand|Select|Wrap|Line Numbers
  1. document.write("<td class='product_image'>");
  2. document.write("<img id='"+i+"'/>");
  3. document.images[i].src = product[i];
  4. document.write("</td>")
  5.  
i also tried it like this but it also didn't work
Expand|Select|Wrap|Line Numbers
  1. document.image("<img src="+product[i]+"/>"
  2.  
html wise its just a script in the body that calls a function to performs this and some other items that I already have working

Any help would be nice,
praclarush
The first thing that cought my eye was:

- you are creating array elements as image objects and store their paths into their "src" propery, but then (in the cycle) you are assigning path to new objects this way:

[PHP]document.images[i].src = product[i];
[/PHP]
shouldnt it be:
[PHP]document.images[i].src = product[i].src;
[/PHP]

if it wont help, let us know ...
Nov 11 '07 #2
The first thing that cought my eye was:

- you are creating array elements as image objects and store their paths into their "src" propery, but then (in the cycle) you are assigning path to new objects this way:

[PHP]document.images[i].src = product[i];
[/PHP]
shouldnt it be:
[PHP]document.images[i].src = product[i].src;
[/PHP]

if it wont help, let us know ...
hey thinks I can't belive i missed something so simple
thinks a lot for the help,
praclarush
Nov 11 '07 #3

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

Similar topics

2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
5
by: ken | last post by:
I had to reinstall Windows 2000 Pro and of course Access 2000. I HAD each record displaying a photo but now it does not show them. The WEIRD thing is that when I upload the database to my...
3
by: Kristof Thys | last post by:
Hello, I'm writing a ASP.net webservice wich will visualize an image, generated by another application. The generated image is a char*. I can transform this to a String*, but I want to view it...
13
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
2
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try...
0
by: adubra | last post by:
Hi there, I am using a device context (DC) and a buffer to successfully draw to screen. However, when I update the DC at very high frame rate and drag the frame containing the image very quickly...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.