473,657 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Object help displaying images

praclarush
27 New Member
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 1905
Dasty
101 Recognized Expert New Member
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
praclarush
27 New Member
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
4156
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 why it doesn't work? Thanks in advance Tjerk
5
1585
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 website...the image shows up! Is there a setting in Access that I need to chnage because of the reinstall? Thanks. Ken
3
1721
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 as an image in my browser. Is this possible, and how should I do this? thx,
13
2345
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 reached yet (I have gone all the way to page 50 on Google's results!!). Here are my requirements: • I have a DataGrid. Everything will be done from here. Everything. No exceptions. Everything will also be done in VB, without any code-behind to...
7
11613
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 is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
7
10108
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. The properties look the same whether I use XP or 2003 versions of Office. If I take an earlier version of Access and link the image, it puts the image. I can also see the image in 2003. If I link the image using 2003 it only shows the filename....
2
9434
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 my own code all I get is an empty widget. What is wrong with the following program? from Tkinter import *
0
2460
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 over the screen or I drag another window on top of the fast display, I get errors (Pyassertion ....). I believe those are related to a conflict between the thread that is updating the buffer (over which I have control) and the thread that is doing the...
3
4412
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 when iam using a normal web page... but can't in content page.... Code in Master Page <%@ Master Language="C#" AutoEventWireup="true" CodeFile="submaster.master.cs" Inherits="submaster" %> <%@ Register Assembly="AjaxControlToolkit"...
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.