...

View Full Version : VbScript



basic3572002
12-08-2002, 03:01 PM
i see VbScript in .html and i see VbScript in .vbs are vbs file can be use in html.

can you please give me an exampol of vbscript in html use in form events.

thanks

oracleguy
12-09-2002, 02:29 AM
<html>
<head>
<title>vbscript test</title>

</head>

<body>

<script language="VBScript" type="text/vbscript">
Sub clickme ()
msgbox "You've pressed the button!"
End Sub

</script>


<input type="button" value="Click Me" onclick="clickme()" />
</body>
</html>


Is this what you wanted? You also can use it to validate form elements too. But you may want to consider using JavaScript for that because VBScript can be wonky sometimes in non-IE browsers.

whammy
12-09-2002, 02:42 AM
I thought VBScript worked ONLY in IE browsers?

I only use VBScript in conjunction with .ASP server-side (because of this limitation), or for doing other nifty things locally (such as changing the format of a comma separated, double quote delimited text file into a pipe-delimited text file for certain software capabilities, or something similar but more complex to export data stored in a database to clients in the format they prefer).

For anything used on the client-side I definitely stick to javascript.

basic3572002
12-09-2002, 04:05 AM
ok thanks

so javascprit is more use than other script. is this vbScript
code:--------------------------------------------------------------------------------
<html>
<head>
<title>vbscript test</title>

</head>

<body>

<script language="VBScript" type="text/vbscript">
Sub clickme ()
msgbox "You've pressed the button!"
End Sub

</script>


<input type="button" value="Click Me" onclick="clickme()" />
</body>
</html>

can be use in geocities website, do msgbox will run too.

are .asp file is like a webfile like .html, can you please give me an exampol of .asp


thanks

whammy
12-09-2002, 04:08 AM
First of all, yes, that's VBScript. It won't work in anything but an Internet Explorer (i.e. Microsoft) browser however, since it's a proprietary Microsoft language.

It's a bit much to give an example of .asp without you knowing the difference between client-side and server-side scripting, and I don't want to confuse you further.

Have you tried out your geocities webpage in another browser, Like Mozilla, Netscape, Opera, etc.? As soon as you do, you'll see why you don't want to use VBScript for anything client-side.

You're best off learning javascript for client-side form validation first... Once you get the hang of that, then you might want to look into server-side scripting (not necessarily ASP/VBScript, many solutions can accomplish the same things).

If I were you, I'd go here first:

http://hotwired.lycos.com/webmonkey/programming/javascript/tutorials/tutorial1.html

Mhtml
12-09-2002, 04:40 AM
I hope this doesn't confuse you but that onClick attribute isn't needed at all.



<script language="vbScript" type="text/vbscript">
sub Button1_onClick
msgBox "You clicked button 1"
end sub
Sub Button2_onClick
msgBox "You clicked button 2"
end sub
</script>

<form>
<input type="button" name="button1" value="One" />
<br />
<input type="button" name="button2" value="Two" />
</form>

Nifty little things you can do in vbscript that you can't do in js include the ability to change the icon and title on the popup message!



msgBox "This is the message", 16, "This is the title!"


That should give you a critical warning sign on the message box.
But in my opinion you should stay away from vbscript unless it is an intranet where you know that all the browsers will be ie because it just isn't worth it if you have javascript to use.

basic3572002
12-10-2002, 12:58 PM
what application program will you recommend to me for creating .html that use Java Script, for function event use.

I create webpage on microsoft word. but javascript cannot be use it wont run.

do JavaScript can able to do Database web.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum