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. -
//declare image array
-
var product = new Array();
-
product[0] = new Image();
-
product[1] = new Image();
-
product[2] = new Image();
-
product[3] = new Image();
-
product[4] = new Image();
-
product[5] = new Image();
-
product[6] = new Image();
-
product[7] = new Image();
-
product[8] = new Image();
-
product[9] = new Image();
-
//populate image array
-
product[0].src = "images/colorpads.jpg";
-
product[1].src = "images/glue.jpg";
-
product[2].src = "images/highlighter.jpg";
-
product[3].src = "images/notecard.jpg";
-
product[4].src = "images/pad.jpg";
-
product[5].src = "images/pen.jpg";
-
product[7].src = "images/pencil.jpg";
-
product[8].src = "images/permmarkers.jpg";
-
product[9].src = "images/scissors.jpg";
-
and here is the code that i tried to use -
document.write("<td class='product_image'>");
-
document.write("<img id='"+i+"'/>");
-
document.images[i].src = product[i];
-
document.write("</td>")
-
i also tried it like this but it also didn't work -
document.image("<img src="+product[i]+"/>"
-
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
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. -
//declare image array
-
var product = new Array();
-
product[0] = new Image();
-
product[1] = new Image();
-
product[2] = new Image();
-
product[3] = new Image();
-
product[4] = new Image();
-
product[5] = new Image();
-
product[6] = new Image();
-
product[7] = new Image();
-
product[8] = new Image();
-
product[9] = new Image();
-
//populate image array
-
product[0].src = "images/colorpads.jpg";
-
product[1].src = "images/glue.jpg";
-
product[2].src = "images/highlighter.jpg";
-
product[3].src = "images/notecard.jpg";
-
product[4].src = "images/pad.jpg";
-
product[5].src = "images/pen.jpg";
-
product[7].src = "images/pencil.jpg";
-
product[8].src = "images/permmarkers.jpg";
-
product[9].src = "images/scissors.jpg";
-
and here is the code that i tried to use -
document.write("<td class='product_image'>");
-
document.write("<img id='"+i+"'/>");
-
document.images[i].src = product[i];
-
document.write("</td>")
-
i also tried it like this but it also didn't work -
document.image("<img src="+product[i]+"/>"
-
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 ...
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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,
|
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...
|
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
| |
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....
|
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 *
|
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...
|
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"...
|
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...
|
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,...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |