position of vbscript in js causing errors

B

Beemer Biker

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
=======================================================================
 
D

David Berry

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top