|
-
Mar 16th, 2002, 05:36 PM
#1
Thread Starter
Lively Member
Java vs VBScript
When I am using VBscript in HTML-code I can recieve text from e.g. a textbox with this code:
<%var1=request.form("theText")%>
or
<%var1=request.querystring("theText")%>
Can this be done in JavaScript, or must I use Perl or cgi or something else if I want it to work on Netscape ??
-
Mar 16th, 2002, 05:50 PM
#2
Member
The question is not wholly clear to me. In server processing, HTML is sent to a browser, and it does not matter whether a user is using IE or NetScape.
For serverside processing on a WebServer with an ASP engine you can use both VBScript and JavaScipt, though I have no experience with JavaScript. But I know it is possible and you can approach the Request-object.
-
Mar 18th, 2002, 04:09 AM
#3
Hyperactive Member
If the server is set up for it, you can also use PerlScript for ASP processing......
-
Mar 18th, 2002, 04:18 AM
#4
Fanatic Member
Javascript only works on with the current page loaded as it works client side, not server side. If you want to get data from a form client side use the document object modal.
<script language="javascript" type="text/javascript">
function displayItems(){
for (i=0;i=document.form1.elements.length;i++){
alert (document.form1.elements[i].value);
}
}
</script>
<form name="form1">
<input type="text" name="text1">
<input type="text" name="text2">
<input type="text" name="text3">
</form>
or you can reference an Item directly : -
<script language="javascript">
alert (document.form1.text1.value);
</script>
but this is only client side. You cant hit the forms submit button and use javascript to get data from the form, only something like ASP, PHP or CGI/Perlscript will work as it works with the Server.
-
Mar 18th, 2002, 10:30 AM
#5
Frenzied Member
You can't do what you are trying to do in this way. *ALL* Server side code executes before the html is sent to the browser. To get values from the client side DOM you have to either submit the data back to the page and get it from the Request.Form collection or use querystrings to re-request the page, passing the values in the URL line and get them from the Request.Querystring collection.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Mar 19th, 2002, 04:58 PM
#6
Thread Starter
Lively Member
Yes, but can that be done in JavaScript ??
-
Mar 19th, 2002, 05:17 PM
#7
Frenzied Member
Abel, I'm afraid there is a basic understanding of web technologies that you lack. Let's make this as simple as possible.
What are you trying to do?
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Mar 19th, 2002, 05:23 PM
#8
Member
Yes you can, but why do you want to use Serverside JavaScript?
Please explain!
Assumedly, using Javascript on the server, will give you the same handicap. The Request object is approachable with any valid serverside language, but not from the client without making a new call. Like Monte96 said, any serverside processing happens before the HTML is sent to the browser.
-
Mar 19th, 2002, 05:26 PM
#9
Thread Starter
Lively Member
I know that I'm not that good at writing asp-code.
I have a page with a textbox and a submit-button.
The user writes his name in the box and press the button. Then a new page will be loaded which says "Hi James" (if he filled in James in the textbox)
I have made this using VbScript, but couldn't do it using JavaScript.
Can it be done ??
-
Mar 19th, 2002, 05:32 PM
#10
Frenzied Member
I would imagine it can.
Now do you realize that this will be using server-side JavaScript, and not client-side JavaScript?
If so, then go to developer.netscape.com and look for the documentation on server-side JavaScript.
Are you moving away from ASPs?
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Mar 19th, 2002, 05:33 PM
#11
Frenzied Member
Is this what you want?
Code:
<script language="javascript">
Function checkUser()
{
var1 = "<%=request.form("txtUser")%>"
if (va1!="")
alert("Hi " + var1);
}
</script>
seoptimizer2001
VB 6.0, VC++, VI, ASP, JavaScript, HTML,
Perl, XML, SQL Server 2000
If God had intended us to drink beer, He would have given us stomachs.
Please use the [code] and [vbcode] tags in your posts!
If you don't know how to use them please go HERE!

-
Mar 19th, 2002, 05:37 PM
#12
Thread Starter
Lively Member
Well, I'm trying to build an own community (very small), just to see if I can make it. I build one using VBScript, but since you must have Explorer then I wanted to build it in some other language and thought of JavaScript.
-
Mar 20th, 2002, 03:29 AM
#13
Fanatic Member
Client side VBScript only works with Internet Explorer BUT ASP works server side so it works with any browser. The ASP interpreter (not sure if this the corrent word in this case ) takes the ASP source code and displays it as HTML. Thats why you take a look at the source code, in a browser, in any ASP page, it displays it as HTML and not your ASP code.
If you really want to try another language try installing PHP and learning a bit of that, its similar to ASP, but has similar syntax to Javascript.
You might have a bit of luck with server-side Javascript but I recommend staying away from it.
-
Mar 20th, 2002, 06:12 AM
#14
Thread Starter
Lively Member
-
Mar 20th, 2002, 07:18 AM
#15
Black Cat
ASP supports JScript, which is Microsoft's "interpretation" of javascript, so you could do that if you like javascript syntax better than VBScript syntax.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
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
|