473,386 Members | 1,752 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,386 software developers and data experts.

HELP Javascript causing issues

I copied the code from another HTML script that someone before me had
written. I have no Javascript experience (I'm a VB Programmer/DBA) at
all.

The code below works to a certain extent. There are two things I need
to get rid of though. One, this code keeps the calling window open
(i.e., when you click on the URL, a new IE window opens--which is
fine--but I can't seem to get the code right to close it. This is the
Javascript I have so far:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>
<head>

<script language = "javascript">

function GetArg()

{

arg = (unescape(location.href)).split("?");
arg = arg[1];

return arg;

}

</script>

<title></title>

</head>

<body bgcolor="#000080">

<p align="center"><font size="5" color="#800000"><b><span
style="background-color: #FFFFFF">Opening
Database</span></b></font>
</p>

</body>

<script language = "javascript">

{

window.navigate("file:///C:/avail.bat");
parent.window.close;

}

</script>

</html>

Avail.bat is simply the following:

cmd /c start msaccess "C:\Jomar Based Availability with WIP.mdb"

If you follow the URL that calls this Javascript, you get a file open
confirmation message, which I would like to override (this URL is only
on an intranet, so it's only going to people I know) or simply stop.

How can I:

1. Close the IE window that calls this Javascript once the Access
database is open (i.e., the batch has run)?

2. Override the confirmation message that pops up?
Jul 23 '05 #1
8 1522
In article <22**************************@posting.google.com >,
bw****@badgersportswear.com enlightened us with...
The code below works to a certain extent. There are two things I need
to get rid of though. One, this code keeps the calling window open
(i.e., when you click on the URL, a new IE window opens--which is
fine--but I can't seem to get the code right to close it. This is the
Javascript I have so far:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
Um, we're up to 4.01 these days, and with no URL, it uses quirks mode. That's
bad. However, it's also very much OT in this group. :)

<html>
<head>

<script language = "javascript"> The language attribute is deprecated. Use type.
<script type="text/javascript">
</head>

<body bgcolor="#000080">

<p align="center"><font size="5" color="#800000"><b><span
style="background-color: #FFFFFF">Opening
Database</span></b></font>
</p>
This is an old page, isn't it?
CSS is your friend. *g*

</body>

<script language = "javascript">

{

window.navigate("file:///C:/avail.bat");
window.navigate?
Is this for IE only? I hope so...because that's all it will work in!! *heh*
parent.window.close; um, what's that for?
To close the IE window?
But you can't do that without confirmation. It isn't nice to close people's
windows and javascript is made to be used for the internet. It doesn't know
you're using it for an intranet app. Unless you use an HTA. See below.

If you follow the URL that calls this Javascript, you get a file open
confirmation message, which I would like to override (this URL is only
on an intranet, so it's only going to people I know) or simply stop.

How can I:

1. Close the IE window that calls this Javascript once the Access
database is open (i.e., the batch has run)?

2. Override the confirmation message that pops up?


IMO...You're going about this ALL wrong.
You want to have something that your users (who all have windows and MSIE)
can use to open an Access file, then it closes itself with no confirmation?
You want an HTA.

Have a looky-see here. This just opens Excel and closes the HTA window (NOT
the IE window that opened the HTA, just so we're clear).
It can be opened from IE with a url or file->open or it can just be double-
clicked or file->open from windows explorer or whatever.

test.hta:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Run Executable HTA</TITLE>
</HEAD>
<body bgcolor=#565656>
<script language="javascript" type="text/javascript">
var oShell = new ActiveXObject("WScript.Shell");
var prog = "C:\\Program Files\\Microsoft Office\\Office\\Excel.exe";
oShell.run ('"'+prog+'"',1);
window.close();
</script>
</BODY>
</HTML>

--
--
~kaeli~
User: The word computer professionals use when they mean
'idiot'.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
What is an HTA? This sounds intriguing.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
"Brent White" <bw****@badgersportswear.com> wrote in message
news:41**********************@news.newsgroups.ws.. .
What is an HTA? This sounds intriguing.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Basically, an HTM file with an HTA extension.

Strat by simply renaming any Web page.

Next look up "HTML Application" via Google.

http://msdn.microsoft.com/workshop/a...taoverview.asp
Jul 23 '05 #4
By the way, thank you for your help. You're talking to a VB programmer,
not a web developer, so, as you probably figured, my experience in HTML
is very limited.

Okay, that HTA sounds pretty neat and the Excel example seems to do
exactly what I need. I don't mind the original window staying open,
because the calling program is a Java program, as long as no EXTRA
windows (which was what I was finding in my example above) stay open.

Unfortunately, I still don't have something quite right. I took your
code and modified it to point to Microsoft Access.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Run Executable hta</title>
</HEAD>
<body bgcolor=#565656>
<script language="javascript" type="text/javascript">
var oShell = new ActiveXObject("WScript.Shell");
var prog = "C:\\Program Files\\Microsoft Office\\Office\\msaccess.exe";
oShell.run ('"'+prog+'"'+'C:\JomarBasedAvailabilityWithWIP.md b',1);
window.close();
</script>
</BODY>
</HTML>
When I open the .hta file, it says it can not find the .mdb file, even
though I checked the spelling, and the permissions are allowing everyone
to access the file.

I'd post this on Google, but it takes a long time to get a response and
I thought Developersdex might be faster.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5
Cancel that. I think I got it straight.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6
In article <41**********************@news.newsgroups.ws>,
bw****@badgersportswear.com enlightened us with...
Cancel that. I think I got it straight.


Cool.
(hta = hypertext application, by the way, and they can be standalone as well
as web)

If you wasnt to learn more, see
http://msdn.microsoft.com/workshop/a...taoverview.asp

HTA's are also cool for VB programmers because you don't have to use
javascript. They support VBScript just fine. Since it's IE only anyway, you
can use either language.

HTH

--
--
~kaeli~
Support your local medical examiner: die strangely!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #7
Yeah, we use IE 6 at this office, though I'm really more of a Mozilla
fan.

That's good to know about VBScript. I've never programmed Java in my
life and, though I want to learn, it's a learning process.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #8
On 27 Oct 2004 15:08:00 GMT, Brent White wrote:
Yeah,
? Please quote a little of what you are replying to,
with reply directly following.
..we use IE 6 at this office, though I'm really more of a Mozilla
fan.

That's good to know about VBScript. I've never programmed Java..


kaeli did not mention Java (a language quite distinct from
Javascript/JScript or VB Script) at any point.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #9

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

Similar topics

19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
4
by: mwh | last post by:
Hi. If you remember, I posted Expressons Help. Now I am making a calculator with javascript. I can't get this to work: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
14
by: Karin Jensen | last post by:
Hi - I am trying to use Javascript to put material inside a table (i.e. alongside the previous material) if the user's screensize is big enough and outide the table (beneath table) if it isn't. ...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
7
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
23
by: WebFoot | last post by:
Is there a reliable way for a webpage to either break out or refuse to display when a hostile website puts it in a frame? I know about the JavaScript solution, but not all visitors have...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...

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.