Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Geeting ImageUrl when changed by javascript

 
Thread Tools Search this Thread
Old 03-04-2004, 07:41 PM   #1
Default Geeting ImageUrl when changed by javascript


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
  Reply With Quote
Old 03-04-2004, 08:31 PM   #2
Eric Lawrence [MSFT]
 
Posts: n/a
Default Re: Geeting ImageUrl when changed by javascript
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]
  Reply With Quote
Old 03-04-2004, 08:35 PM   #3
Joe
 
Posts: n/a
Default Re: Geeting ImageUrl when changed by javascript
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
  Reply With Quote
Old 03-04-2004, 08:55 PM   #4
Eric Lawrence [MSFT]
 
Posts: n/a
Default Re: Geeting ImageUrl when changed by javascript
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]
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46