Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Radio box and ASP ??


Message #1 by farsk@s... on Thu, 16 Jan 2003 21:50:19
	It's obvious that you mix up server-side code and client-side code.
If you display the source code from your browser once the page is 
loaded,
and compare it to the original file, you could see clearly.

	All server-side code (enclosed by <% and %>) is replaced by output
of response.write and =3D.  So, any variable declared in server is just 
lost
once the webpage is sent to the client.

	So, in particular, look at what you would get in your update()
function in client side.

> -----Message d'origine-----
> De : farsk@s... [mailto:farsk@s...]
> Envoy=C3=A9 : jeudi 16 janvier 2003 22:50
> =C3=80 : javascript
> Objet : [javascript] Radio box and ASP ??
>
>
> I have a table called Pricelist and in the Pricelist I have 4
> different
> prices and I want to show those prices with radio box selection.
>
> how can I select one radio box and at the same time it shows
> that price in
> another place in the same page ?
>
> I used this code but it does not working !!!
>
> ---------------------------------
> <%
> Response.Write "<form name=3Dpriceform metod=3D'get' action=3D''>"
>
> 'with this variable I select the first price as a default
> Dim pickselected
> pickselected =3D 1
>
> 'I loop through the table and read all the prices
> Do While Not Pricelist.EOF
>
>   'render the price
>   Response.write "<input type=3Dradio name=3Dprices value=3D" & 
PriceList
> ("Price") & " "
>          if pickselected =3D 1 then
> 	    Response.Write "checked"
>          else
>             Response.Write ""=09
>          end if
>         
>          Response.write " onClick=3Dupdate(this.value)'>"
>          Response.Write Pricelist("PriceDetail")
>                        
>          ' finish the row...
>   'next...
>   Pricelist.MoveNext
>   pickselected =3D pickselected +1
>
> Loop
> %>
> <script language=3D"JavaScript">
>
> function update(i)
> {
>   <%=3Dpriceslected%> =3D i;
> }
> </script>
>
> <%
> 'I try to write the price selected by radio box BUT IT DOES
> NOT WORKING ?
> Response.write priceslected
> %>

  Return to Index