Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Sending values from server side to Client side javascript

Reply
Thread Tools

Sending values from server side to Client side javascript

 
 
Renuka
Guest
Posts: n/a
 
      11-13-2003
Hello,

Can someone help me with the following situation??

I have a Hyperlink within a String like below:

sSql = "SELECT DISTINCT " + "'Action' = '<center><a
href='+char(34)+'ChangeRequest.aspx?ID='+cast(Chan geRequest.ChangeRequest_ID
as nvarchar) +CHAR(34)+'>Open</a></center>',"

I want to invoke a Client side javascript function and pass the value
of the ID. How can I accomplish this such when a user clicks "Open" he
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= 'javascript:
NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
CHAR(34)+)'>Open</a></center>',"

On Client side:
function NewWindow(myID)
{
window.open("ChangeRequest.aspx?ID="+myID,"WindowN ame","width=500,height=600");
}
</script>
 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      11-13-2003
"Renuka" wrote on 13/11/2003:

> Hello,
>
> Can someone help me with the following situation??
>
> I have a Hyperlink within a String like below:
>
> sSql = "SELECT DISTINCT " + "'Action' = '<center><a
>

href='+char(34)+'ChangeRequest.aspx?ID='+cast(Chan geRequest.ChangeRequ
est_ID
> as nvarchar) +CHAR(34)+'>Open</a></center>',"
>
> I want to invoke a Client side javascript function and pass the

value
> of the ID. How can I accomplish this such when a user clicks "Open"

he
> 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=

'javascript:
> NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
> CHAR(34)+)'>Open</a></center>',"
>
> On Client side:
> function NewWindow(myID)
> {
>

window.open("ChangeRequest.aspx?ID="+myID,"WindowN ame","width=500,heig
ht=600");
> }
> </script>


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)


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting values into a form: PHP (Server) or Javascript (Client) Side? Good Man HTML 1 03-03-2006 04:13 PM
server side code access the text of <asp:label> changed by client-side javascript code? nick ASP .Net 3 12-15-2004 06:26 PM
Run Server-side Function *immediately after* executing client-side JavaScript. Guadala Harry ASP .Net 4 06-15-2004 07:04 AM
suggestions on: Create/delete/modify element(s) for server side from Javascript/client-side? Shaul Feldman ASP .Net 0 04-16-2004 09:55 PM
Calling client side Javascript from a server side button =?Utf-8?B?Qw==?= ASP .Net 1 01-16-2004 05:56 PM



Advertisments