|
-
Oct 6th, 2005, 08:52 PM
#1
Thread Starter
Addicted Member
execute or call client side script on server side
Hi, how can I call a client side script on server side?
one thread here said use response.write("<script language = 'javascript>function Hello() {alert('hello');}</script>") but I tried it and it doesn't work, asp.net doesn't write it as text on the page but it doesn't execute the script too....
please help...
thanks
Last edited by jewel; Oct 12th, 2005 at 05:05 AM.
xoxo
-
Oct 7th, 2005, 06:15 AM
#2
Re: execute or call client side script on server side
Use Page.RegisterClientScriptBlock to have the function written to the page, and use
Page.RegisterStartupScript("myscript", "<script language=javascript>Hello();</script>")
to call it.
-
Oct 7th, 2005, 06:53 AM
#3
Thread Starter
Addicted Member
Re: execute or call client side script on server side
Hi, this doesn't call the script right? It needs another control that calls it ex. onClick or onLoad...etc...I need something that calls a script inside a code behind procedure...
for example:
Code:
public sub Load
response.write ("hello");
executeScript here....
.
.
.
End sub
-
Oct 7th, 2005, 07:01 AM
#4
Re: execute or call client side script on server side
In place of "executescript here...." put
Page.RegisterStartupScript("myscript", "<script language=javascript>Hello();</script>")
-
Oct 7th, 2005, 07:19 AM
#5
Thread Starter
Addicted Member
Re: execute or call client side script on server side
Thanks...
I put :
Code:
Page.RegisterStartupScript("my", "<script language=javascript>function Hello(){alert('hello');}</script>")
that's why it didn't run...thanks...
-
Oct 7th, 2005, 07:39 AM
#6
Re: [resolved]execute or call client side script on server side
Does this mean your problem is solved?
-
Oct 12th, 2005, 05:06 AM
#7
Thread Starter
Addicted Member
Re: execute or call client side script on server side
Hi, its me again, what if it's a vbscript?
I tried
Code:
Page.RegisterStartupScript("my", "<script language=vbscript>
Call mySubPro</script>")
please help
-
Oct 13th, 2005, 07:34 AM
#8
Re: execute or call client side script on server side
Does mySubPro exist on the page?
-
Oct 14th, 2005, 03:23 AM
#9
Thread Starter
Addicted Member
Re: execute or call client side script on server side
Yes
-
Oct 14th, 2005, 04:59 AM
#10
Re: execute or call client side script on server side
This is probably related to your other problem... the sub doesn't exist on the page, but you are generating it too.
I'd suggest you either generate it properly or write it directly onto the page.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|