| re: Sending values from server side to Client side javascript
"Renuka" wrote on 13/11/2003:
[color=blue]
> Hello,
>
> Can someone help me with the following situation??
>
> I have a Hyperlink within a String like below:
>
> sSql = "SELECT DISTINCT " + "'Action' = '<center><a
>[/color]
href='+char(34)+'ChangeRequest.aspx?ID='+cast(Chan geRequest.ChangeRequ
est_ID[color=blue]
> as nvarchar) +CHAR(34)+'>Open</a></center>',"
>
> I want to invoke a Client side javascript function and pass the[/color]
value[color=blue]
> of the ID. How can I accomplish this such when a user clicks "Open"[/color]
he[color=blue]
> goes to a new window with the same ID.
>
> I tried this but it does not work:
> On Server side:
> sSql = "SELECT DISTINCT " + "'Action' = '<center><a href=[/color]
'javascript:[color=blue]
> NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
> CHAR(34)+)'>Open</a></center>',"
>
> On Client side:
> function NewWindow(myID)
> {
>[/color]
window.open("ChangeRequest.aspx?ID="+myID,"WindowN ame","width=500,heig
ht=600");[color=blue]
> }
> </script>[/color]
You are trying to launch a pop-up window with URL that is generated
server-side. If so, have your server-side script produce this link:
<A href="#"
onclick="window.open('ChangeRequest.aspx?ID=INSERT-YOUR-ID-VALUE-HERE'
, 'your-window-name', 'width=500,height=600')">Open</A>
Mike
--
Michael Winter
M.Winter@[no-spam]blueyonder.co.uk (remove [no-spam] to reply) |