Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call a javascript function 1

Status
Not open for further replies.

Gamera99

Programmer
May 17, 2001
59
JP
Hello does anyone know how to call a javascript function from within a server-side vbscript section?
So say I have a vbscript event like:

<%
sub cmdSave_onClick()
something
something
javascript openPopWindow(xx,xx,xx)
end sub
%>

Thanks if anyone can help.
 
<%
sub cmdSave_onClick()
if something then
Response.write &quot;<script language=&quot;&quot;javascript&quot;&quot;>openPopWindow(xx,xx,xx);</script>&quot;
end if
end sub
%>

hth
leo
 
Why the heck didn't I think of that.
Thanks Leo
 
I am interested in this server side vbscript
brought up by Gamera99.

Could anyone please tell me how to &quot;click
a button to trigger the button onClick event
on SERVER SIDE&quot;?
Thanks!
 
All you have to do is drop a button design-time-control (DTC) on your ASP, call it cmdSave, and the proper subroutine for the click event is:

<%
sub cmdSave_onClick()
do something
end sub
%>

If you do a response.Redirect in the subroutine, make sure to put the sub at the top of your page above the first <html> tag, otherwise the page will start writing to the browser before the redirect hits, and you will get an error.

I use the same structure with DTC listboxes optiongroups, etc:

<%
sub listbox_onChange()
do something else
end sub
%>
 
Here is an example of client side event trigger...
U need to add some asp coding where u need to do that from server side...

<HTML>
<HEAD>
<SCRIPT>
function fnFireEvents()
{
oDiv.innerText = &quot;The cursor has moved over me!&quot;;
oButton.fireEvent(&quot;onclick&quot;);
}
</SCRIPT>
</HEAD>
<BODY>
<h1>Using the fireEvent method</h1>
By moving the cursor over the DIV below, the button is clicked.
<P>
<DIV ID=&quot;oDiv&quot; onmouseover=&quot;fnFireEvents();&quot;>
Mouse over this!
</DIV>
<p>
<BUTTON ID=&quot;oButton&quot; ONCLICK=&quot;this.innerText='I have been clicked!'&quot; >
Button</BUTTON>
</BODY>
</HTML>

________
George, M
email : shaddow11_ro@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top