473,379 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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="VBScript" TYPE="text/vbscript">
Function vbWriteText(str, strFilename)
dim objFSO, objTextFile
set objFSO = CreateObject("Scripting.FileSystemObject")
set objTextFile = objFSO.OpenTextFile(strFilename,2,true,0)
objTextFile.WriteLine(str)
objTextFile.Close
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=javascript>
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 2852


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
<scriptelement 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="JavaScript" 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="javascript: 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"first 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.supernews.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="VBScript" TYPE="text/vbscript">
Function vbWriteText(str, strFilename)
dim objFSO, objTextFile
set objFSO = CreateObject("Scripting.FileSystemObject")
set objTextFile = objFSO.OpenTextFile(strFilename,2,true,0)
objTextFile.WriteLine(str)
objTextFile.Close
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=javascript>
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
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...
14
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...
1
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
by: duncan | last post by:
why does this work :- <HEAD> ...... <SCRIPT LANGUAGE="javascript"> function test() { alert("test 1") } </SCRIPT>
6
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...
12
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...
6
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...
19
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...
13
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.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.