473,320 Members | 1,881 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.

Referencing an image via ID on main page from second form

RWC
Hello,

I have a page connected to an SQL table. The page loops through, creating a
row for each record, displaying in image, the ID of which is set to the
record id. When I click a button to change the image, I'd like to refer to
the ID on the main page, but change the image on the main page. Any idea
how to do this?

Example is as follows

Record 1 ID=1 NAME=Image1 Src=bird.jpg
Record 2 ID=2 NAME=Image1 Src=horse.jpg
Record 3 ID=3 NAME=Image1 Src=cow.jpg
When I open the child window and select a new image for Record 3, I'd like
to change the record 3 src to insect.jpg.

I've changed the value of things based on teh Name element but never the ID.
How do I do that?

Any help would be great!

Thanks in advance!
Rick
Jul 23 '05 #1
2 1389
RWC wrote:
Hello,

I have a page connected to an SQL table. The page loops through, creating a row for each record, displaying in image, the ID of which is set to the record id. When I click a button to change the image, I'd like to refer to the ID on the main page, but change the image on the main page. Any idea how to do this?

Example is as follows

Record 1 ID=1 NAME=Image1 Src=bird.jpg
Record 2 ID=2 NAME=Image1 Src=horse.jpg
Record 3 ID=3 NAME=Image1 Src=cow.jpg
These are not valid id's. An id:

"...must begin with a letter ([A-Za-z]) and may be followed by any
number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".")"

Though they probably work in most browsers (but that doesn't make them
valid HTML).

Using identical names for the images will cause problems also, though
most browsers will tolerate it. Names on images should be unique.
Browsers will likely return the first image with the name, but you
should not depend on that behaviour.

Your HTML should look something like like:

<tr><td><img name="Image1" id="Image1" src="brid.jpg"></td></tr>
<tr><td><img name="Image2" id="Image2" src="horse.jpg"></td></tr>
<tr><td><img name="Image3" id="Image3" src="cow.jpg"></td></tr>

Others may comment on the use of tables for layout...
When I open the child window and select a new image for Record 3, I'd like to change the record 3 src to insect.jpg.

I've changed the value of things based on teh Name element but never the ID. How do I do that?


The easiest way is to use the images collection:

opener.document.images['Image3'].src = 'insect.jpg'

--
Rob

Jul 23 '05 #2
RWC
Excellent. Thanks Rob, I will give that a try.

Rick

"RobG" <rg***@iinet.net.au> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
RWC wrote:
Hello,

I have a page connected to an SQL table. The page loops through,

creating a
row for each record, displaying in image, the ID of which is set to

the
record id. When I click a button to change the image, I'd like to

refer to
the ID on the main page, but change the image on the main page. Any

idea
how to do this?

Example is as follows

Record 1 ID=1 NAME=Image1 Src=bird.jpg
Record 2 ID=2 NAME=Image1 Src=horse.jpg
Record 3 ID=3 NAME=Image1 Src=cow.jpg


These are not valid id's. An id:

"...must begin with a letter ([A-Za-z]) and may be followed by any
number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".")"

Though they probably work in most browsers (but that doesn't make them
valid HTML).

Using identical names for the images will cause problems also, though
most browsers will tolerate it. Names on images should be unique.
Browsers will likely return the first image with the name, but you
should not depend on that behaviour.

Your HTML should look something like like:

<tr><td><img name="Image1" id="Image1" src="brid.jpg"></td></tr>
<tr><td><img name="Image2" id="Image2" src="horse.jpg"></td></tr>
<tr><td><img name="Image3" id="Image3" src="cow.jpg"></td></tr>

Others may comment on the use of tables for layout...
When I open the child window and select a new image for Record 3, I'd

like
to change the record 3 src to insect.jpg.

I've changed the value of things based on teh Name element but never

the ID.
How do I do that?


The easiest way is to use the images collection:

opener.document.images['Image3'].src = 'insect.jpg'

--
Rob

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: J. Black | last post by:
Hello everyone - I've been developing an incident tracking and reporting system for an emergency services outfit that I work with part time. It's going well, except for one fly in the ointment....
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...
4
by: cjaserver | last post by:
This works fine in IE, but is breaking in Firefox, and reported in Netscape as well. I can't determine why. http://www.chartermainstreetgld.com click on the real estate section on the left nav...
8
by: Cardman | last post by:
I am hopeful that someone can quickly solve my image alignment issue when things are just not going right and where my attempts to solve this alignment issue have all failed. First of all take a...
3
by: Dave | last post by:
Hey all, I have a problem and I can't find anything on the net to really address it. We have a program at work that has lots of numbers on the front of the form because it is a control program...
2
by: Tom | last post by:
I need to be able to reference some images stored in my VB.NET program. Normally, I would load the images into an ImageList control and use them from there (these are going to be icons). However, I...
3
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image'...
8
by: Fred | last post by:
Hi People, I have a bit of a problem on my hands and wondered if anyone here has done anything similar! I have a VB6 application that displays an image stored locally (all easy stuff so far)....
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.