473,603 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can run javascript can't run vbscript - WHY

why does this work :-

<HEAD>
......
<SCRIPT LANGUAGE="javas cript">
function test()
{
alert("test 1")
}
</SCRIPT>
.....
</HEAD>
<BODY>
....
<A HREF="JavaScrip t:test">test</A>
......
</BODY>

but this does not :-

<HEAD>
......
<SCRIPT LANGUAGE="vbscr ipt">
function test()
msgbox("VB Test")
end function
</SCRIPT>
......
</HEAD>
......
<BODY>
....
<A HREF="vbscript: test">test</A>
....
</BODY>

As you can see the only real difference is I have changed JavaScript
to be vbscript and this is the problem. I don't even get a script
error reported by IE6 when I try to run the VB version. I tried
varying vbscript eg vb, vbs but nothing happens.

Why can I not run my vb function just like I can Javascript. It
defies logic (or at least mine!! which says a simple name change
should not cause this problem)

What I am trying to achieve is to run my actual code as a client side
script - with NO postback. I have managed to run some JavaScript
without causing a post back using the <A>...</A> and I can run my vb
actual code from a <ASP:BUTTON> but this causes a postback. I want
to use vb/vbscript as I am familiar with vb and want to get my pages
working asap.

One very frusttrated newbie (to ASP.NET / VB.NET)
Duncan
Nov 18 '05 #1
2 2487
The alert method is part of the document object model; it has nothing to do
with javascript. Try to use the alert method in your vbscript code block

<Script language="vbscr ipt">
Function test()
alert("VB Test")
End Function
</Script>
"duncan" <dw***@woodace. co.uk> wrote in message
news:8f******** *************** ***@posting.goo gle.com...
why does this work :-

<HEAD>
.....
<SCRIPT LANGUAGE="javas cript">
function test()
{
alert("test 1")
}
</SCRIPT>
....
</HEAD>
<BODY>
...
<A HREF="JavaScrip t:test">test</A>
.....
</BODY>

but this does not :-

<HEAD>
.....
<SCRIPT LANGUAGE="vbscr ipt">
function test()
msgbox("VB Test")
end function
</SCRIPT>
.....
</HEAD>
.....
<BODY>
...
<A HREF="vbscript: test">test</A>
...
</BODY>

As you can see the only real difference is I have changed JavaScript
to be vbscript and this is the problem. I don't even get a script
error reported by IE6 when I try to run the VB version. I tried
varying vbscript eg vb, vbs but nothing happens.

Why can I not run my vb function just like I can Javascript. It
defies logic (or at least mine!! which says a simple name change
should not cause this problem)

What I am trying to achieve is to run my actual code as a client side
script - with NO postback. I have managed to run some JavaScript
without causing a post back using the <A>...</A> and I can run my vb
actual code from a <ASP:BUTTON> but this causes a postback. I want
to use vb/vbscript as I am familiar with vb and want to get my pages
working asap.

One very frusttrated newbie (to ASP.NET / VB.NET)
Duncan

Nov 18 '05 #2
abc
At http://telecom.fit.edu/cfdocs/htmlre...g_Scripts.html

you can find :

Scripting as a URL

As mentioned in the first paragraph, script events can also be included as URL's. For example :
<A HREF="javascrip t:alert('You can never have enough examples')">Thi s is the link text</A>

NOTE : At the time of writing, only JavaScript was supported using this method. It works in both Netscape and Internet Explorer. Future versions of Internet Explorer will include support for a <A HREF="vbscript: ...."> syntax.

However, Internet Explorer allows for cross-language referencing. You can use the above construct to call a scripting function, which can be a Visual Basic Script function. For example :
<A HREF="javascrip t:Exec_function ()">This is the link text</A>

<SCRIPT LANGUAGE="VBScr ipt">

<!--

Sub Exec_function

Alert "You executed a Visual Basic Script function called from a JavaScript reference"

End Sub

-->

</SCRIPT>

As you will see further in this scripting reference section, the anchor (<A>) element also supports various events using the above methods. This allows scripting to be combined with hypertext links, so that the link is not exclusively executing a script.

*************** *************** *************** *************** **********
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
11785
by: John Davis | last post by:
Just wonder if <%@ Language="JAVASCRIPT" %> exists?? Since JavaScript is used in client-side scripting, but <% ... %> is used in server-side scripting. It sounds doesn't make sense. But I saw that in a ASP test question before. The question is like this: How can you script your ASP code in JavaScript? The answer is: <%@ Language="JAVASCRIPT" %>
5
6817
by: John Davis | last post by:
When I create new documents in Dreamweaver, there are several choices for ASP creation: ASP JavaScript: run at client side?? ASP VBScript: run at server side?? ASP.NET C# ASP.NET VB I don't understand the differences between ASP JavaScript and ASP VBScript?? Because JavaScript is client-side technology, and ASP is server side technology. I think VBScript is used to implement ASP pages.
1
521
by: Ian Sedwell | last post by:
Hi guys Many thanks to all who replied to my original question. Actually, it's dead easy and the way I was doing it was correct the first time. You do indeed simply call the VBScript routine from the JavaScript routine. It doesn't matter whether the scripts are in external files, or embedded in the HTML document, so long as the VBScript is loaded before it is called from JavaScript - obviously. The VBScript routine can return a result...
13
8457
by: Alex Molochnikov | last post by:
Is there any way to find out programmatically if Javascript is supported/enabled in a browser? By "programmatically" I mean on the Java servlet side. TIA Alex Molochnikov Gestalt Corporation
11
13392
by: Doug van Vianen | last post by:
Hi, I often like to include some JavaScript coding in my web pages to make them more interesting. Unfortunately, even when this coding is as simple as a check to see what the display width is in pixels so that pictures on the page can be adjusted to better fit the display, Internet Explorer detects the coding and blocks it. Of course the user can click on the message displayed above the web page to allow "the active component" but many...
10
4692
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript", you cannot use inline JavaScript statements that call setTimeout with functions that start with a double-underscore. This is very relavant to ASPX (ASP Dot Net) pages because it means that AutoPostBacks will fail since they generally call the...
9
8403
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
18
2376
by: Andrew Wan | last post by:
I have been developing web applications with ASP & Javascript for a long time. I have been using Visual Studio 2003.NET. While VS2003 is okay for intellisense of ASP & Javascript, it's still not that great. One of the cons of ASP & Javascript is that they're both interpreted, which means one has twice the amount of work to do interms of syntax checking & semantic/runtime checking. Another bad thing is that ASP & Javascript doesn't have...
5
9290
by: Tomislav | last post by:
Hello, I tried to use "javascript:return confirm();" function in following manner ( triggered by form onSubmit event ): ** <form method="post" action="mail.php" onSubmit="javascript:return confirm('Do you really want to send this order ?);">
0
7928
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8273
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6735
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.