473,769 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

position of vbscript in js causing errors

I put together a few lines of vbscript so I could dump the contents of a
string to my C drive. It worked fine in a small test.htm where I put the
vbscript at the top of the file. It failed to work (no error message) in my
large program where I needed to dump out the stuff. I did get an error
message from FrontPage 2003 but it was not informative.

When moved the vbscript to the bottom of the page it worked fine!

========start of page======
This is a snippet of the code showing the position at the top of the source
code.

<SCRIPT LANGUAGE="VBScr ipt" TYPE="text/vbscript">
Function vbWriteText(str , strFilename)
dim objFSO, objTextFile
set objFSO = CreateObject("S cripting.FileSy stemObject")
set objTextFile = objFSO.OpenText File(strFilenam e,2,true,0)
objTextFile.Wri teLine(str)
objTextFile.Clo se
end Function
</SCRIPT>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<SCRIPT language=javasc ript>
function make()
{
....a lot of js code...
<META content="MSHTML 6.00.5700.6" name=GENERATOR> </HEAD>
<BODY>
....lot of html...
....
*** reference to make() in body of the page ***
....
</BODY></HTML>
====end of page====

When using MS FrontPage 2003, selecting Preview indicates an error occured
at the reference to "make()" That is the first javascript function in the
javascript code. So it would seem that putting the vbscript before the
javascript caused the body of the page to have trouble finding make() ?
Currently the page works fine with the vbscript at the bottom. I like to
keep functions at the top when I code and I dont see why it could not go
there. I do not understand why my small test program worked but the larger
one didnt (unless I moved the code to the bottom). The larger one is much
more complicated.

...thanks..
--
=============== =============== =============== =============== ===========
Beemer Biker joestateson at grandecom dot net
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
=============== =============== =============== =============== ===========
Oct 12 '06 #1
2 2898


Beemer Biker wrote:
I put together a few lines of vbscript so I could dump the contents of a
string to my C drive. It worked fine in a small test.htm where I put the
vbscript at the top of the file. It failed to work (no error message) in my
large program where I needed to dump out the stuff. I did get an error
message from FrontPage 2003 but it was not informative.

When moved the vbscript to the bottom of the page it worked fine!
If you use more than one script language in a HTML document with
Internet Explorer then the language or type attribute of the first
<scriptelemen t in your document determines the script language IE uses
for event handlers. Thus if you have <script type="text/vbscript"as
the first script element in the document then your event handlers by
default need to be written in VBScript and not JavaScript.
IE additionally allows you to specify the event handler script language
for any element with e.g.
<input language="JavaS cript" onclick="f();"
but that is not a good idea on the web in general.
IE furthermore allows you to specify the script language using e.g.
<input onclick="javasc ript: f();"
but in general on the web that is not a good idea either.
If you really think you need JavaScript and VBScript in one HTML
document and you want JavaScript to be the language IE uses for event
handlers then put a <script type="text/javascript"firs t in your
document before all other <scriptelements .

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 12 '06 #2
What was the error message? Is this an ASP page or HTM page? If it worked
at the bottom of the page why move it?
"Beemer Biker" <js*******@swri .eduwrote in message
news:12******** *****@corp.supe rnews.com...
>I put together a few lines of vbscript so I could dump the contents of a
string to my C drive. It worked fine in a small test.htm where I put the
vbscript at the top of the file. It failed to work (no error message) in
my large program where I needed to dump out the stuff. I did get an error
message from FrontPage 2003 but it was not informative.

When moved the vbscript to the bottom of the page it worked fine!

========start of page======
This is a snippet of the code showing the position at the top of the
source code.

<SCRIPT LANGUAGE="VBScr ipt" TYPE="text/vbscript">
Function vbWriteText(str , strFilename)
dim objFSO, objTextFile
set objFSO = CreateObject("S cripting.FileSy stemObject")
set objTextFile = objFSO.OpenText File(strFilenam e,2,true,0)
objTextFile.Wri teLine(str)
objTextFile.Clo se
end Function
</SCRIPT>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<SCRIPT language=javasc ript>
function make()
{
...a lot of js code...
<META content="MSHTML 6.00.5700.6" name=GENERATOR> </HEAD>
<BODY>
...lot of html...
...
*** reference to make() in body of the page ***
...
</BODY></HTML>
====end of page====

When using MS FrontPage 2003, selecting Preview indicates an error occured
at the reference to "make()" That is the first javascript function in
the javascript code. So it would seem that putting the vbscript before
the javascript caused the body of the page to have trouble finding make()
? Currently the page works fine with the vbscript at the bottom. I like
to keep functions at the top when I code and I dont see why it could not
go there. I do not understand why my small test program worked but the
larger one didnt (unless I moved the code to the bottom). The larger one
is much more complicated.

..thanks..
--
=============== =============== =============== =============== ===========
Beemer Biker joestateson at grandecom dot net
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
=============== =============== =============== =============== ===========

Oct 12 '06 #3

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

Similar topics

6
3807
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able to find out is that Microsoft has had the same problem on their site!
14
10144
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ~Abhijit
1
325
by: Mario Rodriguez | last post by:
HI People, I need to mix ASP.NET (using C#) and vbscript (to handle capicom resources) but I'm getting a lot of javascript errors. There is a safe way to mix vbscript and ASP.NET thanks
2
2493
by: duncan | last post by:
why does this work :- <HEAD> ...... <SCRIPT LANGUAGE="javascript"> function test() { alert("test 1") } </SCRIPT>
6
9007
by: John Kotuby | last post by:
Hi all, I am simply trying to include the Option Explicit declaration at the top of an ASP page and am getting an error: Error Type: Microsoft VBScript compilation (0x800A0400) Expected statement /transferkey.asp, line 2
12
7916
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug it, it works every time! I even set it to True, but did a .Flush just before the error, and the error won't happen. It only happens when response.buffer is True and no .response.flush is issued. The error is a string variable turns-up empty...
6
1957
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is supposed to perform some fucntion when the selected index is changed, it works fine without vbscript code(when i comment out that code) but when I uncomment the code the postback dosen't happen.
19
5942
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up the page but I find that the iframes interfere with the getting the mouse coords from the screen which is essential in moving the scroll bar around. My test html is given below. With the iframe hidden the mouse coords are obtainable. With the...
13
2890
by: Freightliner | last post by:
Hi, this webpage www.roberto089.com displays ok with IE, but with Firefox the 7 Buttons plus the image have shifted up, and the header has shifted on the left. Thanks for help.
0
9583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9860
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
8869
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...
0
6668
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
5297
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...
0
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3955
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

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.