![]() |
|
|
|||||||
![]() |
ASP Net - Geeting ImageUrl when changed by javascript |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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> Joe |
|
|
|
|
#2 |
|
Posts: n/a
|
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:#... > 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> > > Eric Lawrence [MSFT] |
|
|
|
#3 |
|
Posts: n/a
|
can you explain more? possible some code?
Thanks, Joe "Eric Lawrence [MSFT]" <> wrote in message news:uwb8$... > 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:#... > > 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> > > > > > > Joe |
|
|
|
#4 |
|
Posts: n/a
|
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:... > can you explain more? possible some code? > > Thanks, > Joe > > "Eric Lawrence [MSFT]" <> wrote in message > news:uwb8$... > > 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:#... > > > 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> > > > > > > > > > > > > Eric Lawrence [MSFT] |
|