473,396 Members | 1,968 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,396 software developers and data experts.

Geeting ImageUrl when changed by javascript

Joe
I have a function that changes an image when the user clicks a button (this
works fine). There's another button that is used to transfer to another page
an pass the selected image as a querystring. The problem is in the code
behind, Image1.ImageUrl always returns the initial image name. Is there a
way to get the newly selected one?

<script language="javascript">
<!--
var Images = new Array();

Images[0] = "Image1.jpg";
Images[1] = "Image2.jpg";
Images[2] = "Image3.jpg";

var Index = 0;

function ChangeImage(forward)
{
if (forward == true)
{
if (Index >= Images.length - 1)
Index = 0;
else
Index++;

document.frmFriend.Image1.src = Images[Index];
}
else
{
if (Index == 0)
Index = Images.length - 1;
else
Index--;

document.frmFriend.Image1.src = Images[Index];
}
}
//-->
</script>
Nov 18 '05 #1
3 1603
A really simple way would be to have your change image function also update
the value of an <Input type=hidden> tag.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
"Joe" <JBonavita_@_caminus.com> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
I have a function that changes an image when the user clicks a button (this works fine). There's another button that is used to transfer to another page an pass the selected image as a querystring. The problem is in the code
behind, Image1.ImageUrl always returns the initial image name. Is there a
way to get the newly selected one?

<script language="javascript">
<!--
var Images = new Array();

Images[0] = "Image1.jpg";
Images[1] = "Image2.jpg";
Images[2] = "Image3.jpg";

var Index = 0;

function ChangeImage(forward)
{
if (forward == true)
{
if (Index >= Images.length - 1)
Index = 0;
else
Index++;

document.frmFriend.Image1.src = Images[Index];
}
else
{
if (Index == 0)
Index = Images.length - 1;
else
Index--;

document.frmFriend.Image1.src = Images[Index];
}
}
//-->
</script>

Nov 18 '05 #2
Joe
can you explain more? possible some code?

Thanks,
Joe

"Eric Lawrence [MSFT]" <e_********@hotmail.com> wrote in message
news:uw*************@TK2MSFTNGP11.phx.gbl...
A really simple way would be to have your change image function also update the value of an <Input type=hidden> tag.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Joe" <JBonavita_@_caminus.com> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
I have a function that changes an image when the user clicks a button

(this
works fine). There's another button that is used to transfer to another

page
an pass the selected image as a querystring. The problem is in the code
behind, Image1.ImageUrl always returns the initial image name. Is there a way to get the newly selected one?

<script language="javascript">
<!--
var Images = new Array();

Images[0] = "Image1.jpg";
Images[1] = "Image2.jpg";
Images[2] = "Image3.jpg";

var Index = 0;

function ChangeImage(forward)
{
if (forward == true)
{
if (Index >= Images.length - 1)
Index = 0;
else
Index++;

document.frmFriend.Image1.src = Images[Index];
}
else
{
if (Index == 0)
Index = Images.length - 1;
else
Index--;

document.frmFriend.Image1.src = Images[Index];
}
}
//-->
</script>


Nov 18 '05 #3
Provide your code and I'll tweak it.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Joe" <JBonavita_@_caminus.com> wrote in message
news:e7**************@TK2MSFTNGP09.phx.gbl...
can you explain more? possible some code?

Thanks,
Joe

"Eric Lawrence [MSFT]" <e_********@hotmail.com> wrote in message
news:uw*************@TK2MSFTNGP11.phx.gbl...
A really simple way would be to have your change image function also update
the value of an <Input type=hidden> tag.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no

rights.


"Joe" <JBonavita_@_caminus.com> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
I have a function that changes an image when the user clicks a button

(this
works fine). There's another button that is used to transfer to another
page
an pass the selected image as a querystring. The problem is in the
code behind, Image1.ImageUrl always returns the initial image name. Is

there a way to get the newly selected one?

<script language="javascript">
<!--
var Images = new Array();

Images[0] = "Image1.jpg";
Images[1] = "Image2.jpg";
Images[2] = "Image3.jpg";

var Index = 0;

function ChangeImage(forward)
{
if (forward == true)
{
if (Index >= Images.length - 1)
Index = 0;
else
Index++;

document.frmFriend.Image1.src = Images[Index];
}
else
{
if (Index == 0)
Index = Images.length - 1;
else
Index--;

document.frmFriend.Image1.src = Images[Index];
}
}
//-->
</script>



Nov 18 '05 #4

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

Similar topics

0
by: Frank | last post by:
Hey all, I can't seem to get javascript running in my XSL document. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"...
1
by: Trueman | last post by:
Hi all, I've been invoking a javasript method from an applet using the netscape.javascript.JSObject class. All was working fine till I upgraded my JRE from 1.4.0 to 1.5 Now the method...
1
by: | last post by:
Hello, I have a problem when I try to do this on a aspx page.. Is there anything wrong with this approach? This is the javascript function <Script Language='JavaScript'> function...
3
by: jblossom | last post by:
Hello, I'm in a quandary as to how to address a problem. The site in question: http://agapeyoga.com On the left-hand side of the site are image navigation elements that change when clicked...
3
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to...
1
by: tgorton | last post by:
I am having a problem running a javascript function as part of an html-el:form onsubmit. The problem seems to exists in IE6 but not in Firefox. html: <html-el:form action="${target}"...
2
by: PeterAlt | last post by:
Hello all! This is my first post here. I've been going crazy lately trying to master the art of working with and creating my own objects with Javascript. I see the HUGE power potential of object...
1
by: Daniel Jeffrey | last post by:
..Net 2.0 VStudio 2005 C# I know this is going to seem like a strange question, as even I am sure I have missed something - but I cant find it. I want a simple event on any of the objects...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.