writing in javascript and vbscript in the same asp page

liunx

Guest
i wanted to write some code in vbscript and some other in javascript within the same asp page..

could you please help me how to do it

Thank youWith Server side vbscript, it executes before any javascript on the page.

so for example you could do:



<%
Dim strRedirect

strRedirect = "somepage.asp"

%>

<script language="javascript">
window.location.href = <!-- m --><a class="postlink" href="http://www.htmlforums.com/archive/index.php/">http://www.htmlforums.com/archive/index.php/</a><!-- m -->"<%= strRedirect %>"
</script>i would give the exact scenario so that you could help me better.

i was trying to connect to a database in asp using javascript but it didnot work so i went for vbscript and it worked..

but in my later stages...i would like to write asp in javascript..

I am looking for a solution which would either give me the best connection method using javascript or writing asp in javascript and vbscript within the same page.

or is it possible sth like i can store the connection in vbscript in a file and simply include it and i can program the rest of the page in javascript.

pls adviseYou are out of my realm with Server-Side JScript. I don't even like to use it client side.

Here is an article that shows how to connect to a database with Server Side JScript:

<!-- m --><a class="postlink" href="http://www.4guysfromrolla.com/webtech/061800-1.shtmljscript">http://www.4guysfromrolla.com/webtech/0 ... tmljscript</a><!-- m --> is Server Side!!! there is no Javascript Server Side.

rdove on your comment that you don't use it on client side? That is a big mistake. You have to do twice the amount of work on the server then.Originally posted by afterburn
jscript is Server Side!!! there is no Javascript Server Side.

rdove on your comment that you don't use it on client side? That is a big mistake. You have to do twice the amount of work on the server then.

oh I use it, I just don't like to is all. Also, what if they have it turned off? To some degree you should always for both client side and server side validation.Yeah and what if the moon ran into the earth. That has always been a fear of many internet programmers but the fact it has never panned out still does not stop them from worrying.

In reality its not likely as most users that would have a fear of a scripting language can't figure out how to correctly setup their email clients. How do you beleive that they will be able to find the disable javascript raido button in internet explorer.I'm not concerned with the clueless users, it is the people who know what they are doing that concern me. If you are not careful peopke who know what they are doing could really mess up your system.I am more careful than most are. I create custom 404 and 500.100 error pages that send me details about the error and any debugging needed to resolve the issue. No detailed errors about the issue that caused it to the user. Validate data beyond belief and response.end on things that are required like a post from a specified page.

I am more careful than you can imagine. However I am not worried about javascript being turned off, if it is then so what it doesn't execute any of the client script but the server script can handle almost any error that you can try to throw at it.

I create functions for validation that most don't care to even think about. Like validating a product exists or the category selected. There are more things I do to protect the data, if needed. Most crappy pages that I am to write really have no need for most of it. I am the anal-retentive that uses CamelCased Hugarian notation for variable names. You should see my C#, parameter names are all prefixed with "p_", member variables are "m_"
 
Back
Top