Solved

Embed Javascript Within Vbscript

Posted on 1998-10-26
5
541 Views
Last Modified: 2011-09-20
Can I embed Javascript Within Vbscript? Is there any statement to connect to remote database and display back the result.
0
Comment
Question by:vipin072998
  • 3
5 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1272946
Not on the client.
Client based JavaScript (or vbscript) cannot access a remote database.
Serverbased scripts may do what they like and can be written in VBScript or JavaScript under IIS if that is your server.

Michel
0
 
LVL 28

Expert Comment

by:sybe
ID: 1272947
ASP example:
<%
Response.write "<script>alert('script in script')</script>"
%>

But the following gives an error (it's simply forbidden).

<script runat="server" language="vbscript>
Response.write "<script>alert('script in script')</script>"
</script>

But of course the error can easily be avoided:

<script runat="server" language="vbscript>
Response.write "<scri" & "pt>alert('script in script')</script>"
</script>


0
 
LVL 28

Expert Comment

by:sybe
ID: 1272948
ASP example:
<%
Response.write "<script>alert('script in script')</script>"
%>

But the following gives an error (it's simply forbidden).

<script runat="server" language="vbscript">
Response.write "<script>alert('script in script')</script>"
</script>

But of course the error can easily be avoided:

<script runat="server" language="vbscript">
Response.write "<scri" & "pt>alert('script in script')</script>"
</script>


0
 

Author Comment

by:vipin072998
ID: 1272949
Dear Sybe,
I have tried this code but its not working.The following Error is Generated

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/test/default.asp, line 14

Response.write "<scri" & "pt>alert('script in script')
although statement is like
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/test/default.asp, line 14

Response.write "<scri" & "pt>alert('script in script')"
Please check and try it out, I have tried it every way

0
 
LVL 28

Accepted Solution

by:
sybe earned 50 total points
ID: 1272950
You are right, but these  work

<script language="VBScript" RUNAT="Server">
Response.write "<scri" & "pt>alert('script in script')</scr" & "ipt>"
</script>

<%
Response.write "<script>alert('script in script')</script>"
%>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now