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

Two Questions about the Following Block of Code

May I ask you the following? Two questions about the following block
of code:

1) How to open the file in NON-ReadOnly mode? I tried many things, but
none of them was working.

2) Any problems with the lines with document.write (...), as indicated
below?
<script language="JavaScript">

var ua = navigator.userAgent.toLowerCase();

// Browsers: Netscape has a lot of impostors

bNN = (ua.indexOf('mozilla') != -1 && ua.indexOf('compatible') == -1
&&ua.indexOf('opera') == -1 && ua.indexOf('hotjava') == -1
&&ua.indexOf('webtv') == -1 && ua.indexOf('spoofer') == -1);

bIE = (ua.indexOf('msie') != -1 && ua.indexOf('opera') == -1);

function openFile(strFile)
{
if(bIE)
{
alert("ie " + strFile); //open files this way

if(typeof ActiveXObject != 'undefined')
{
// new ActiveXObject can be called.

var myApp = new ActiveXObject("Excel.Application");

//alert("here " + myApp);

if (myApp != null)
{
myApp.Visible = true;
myApp.Workbooks.Open(strFile);
myApp.Workbooks(strFile).Activate;

}
}
}

else
{
alert("other " + strFile); //opening file another way

// Whenever I include the following two lines, the program wouldn't
run, and I saw "Error on Page" at the left bottom corner, right above
the Toolbar. What's wrong with the following two lines?

document.write("<a href='" + strFile + "'
target="_top">");
document.write("</a>");

}
}
</script>

Thank you for your expertise!
Jul 20 '05 #1
4 2057
Lee
Greener said:
2) Any problems with the lines with document.write (...), as indicated
below? document.write("<a href='" + strFile + "' target="_top">");


Should be:

document.write("<a href='" + strFile + "' target='_top'>");

Jul 20 '05 #2
>From: he********@yahoo.com (Greener)

<snip>
<script language="JavaScript">
Language attribute is deprecated in favor of the type attribute:
text="type/javascript"

<FAQENTRY>
type="text/javascript" in favor of language="javascript"
</FAQENTRY>

Not sure on a wording, but its seen a lot here :-(
var ua = navigator.userAgent.toLowerCase();

// Browsers: Netscape has a lot of impostors
Netscape is not the only one with imposters. Most are imposters of Mozilla
though.

bNN = (ua.indexOf('mozilla') != -1 && ua.indexOf('compatible') == -1
&&ua.indexOf('opera') == -1 && ua.indexOf('hotjava') == -1
&&ua.indexOf('webtv') == -1 && ua.indexOf('spoofer') == -1);

bIE = (ua.indexOf('msie') != -1 && ua.indexOf('opera') == -1);
AOL passes the bIE test, but you won't open a document this way in it.

The browser is irrelevant. The test for ActiveXObject suffices. Browsers that
support it (whether IE or not) will support it, those that don't will move on
to the else, again making the browser detection nothing more than an extra set
of un-needed code.

Consult the group FAQ with regards to Browser Detection.

// Whenever I include the following two lines, the program wouldn't
run, and I saw "Error on Page" at the left bottom corner, right above
the Toolbar. What's wrong with the following two lines?


Double click on the Yellow ! and it will show you an exact error message
(although the solution to it has already been posted) and on the error window,
check the "Always show this message" checkbox.
--
Randy
Jul 20 '05 #3
Thanks, Lee.

I tried document.write("<a href='" + strFile + "' target='_top'>"); //
OR using '_blank'

It still cannot open the Excel file. My question is,

1) Is the line "document.write( )" indeed the way in Netscape to open
an Excel file if you pass a http:/ link? Is so, why didn't it work?
Are there any other ways to open files in Netscape?

2) In Internet Explorer, I had to use a different way (creating
ActiveX instance shown in my earlier message) to open an Excel file.
How to force opening the file in NON-ReadOnly mode? I tried many
things, but none of them was working.

Thanks millions!

Helena

Lee <RE**************@cox.net> wrote in message news:<bm*********@drn.newsguy.com>...
Greener said:
2) Any problems with the lines with document.write (...), as indicated
below?

document.write("<a href='" + strFile + "' target="_top">");


Should be:

document.write("<a href='" + strFile + "' target='_top'>");

Jul 20 '05 #4
Thanks for response. I tried document.write("<a href='" + strFile + "'
target='_top'>"); // OR using '_blank'

It still cannot open the Excel file. My question is,

1) Is the line "document.write( )" indeed the way in Netscape to open
an Excel file if you pass a http:/ link? Is so, why didn't it work?
Are there any other ways to open files in Netscape?

2) In Internet Explorer, I had to use a different way (creating
ActiveX instance shown in my earlier message) to open an Excel file.
How to force opening the file in NON-ReadOnly mode? I tried many
things, but none of them was working.

Thanks millions!

Helena

hi************@aol.com (HikksNotAtHome) wrote in message news:<20***************************@mb-m02.aol.com>...
From: he********@yahoo.com (Greener)


<snip>
<script language="JavaScript">


Language attribute is deprecated in favor of the type attribute:
text="type/javascript"

<FAQENTRY>
type="text/javascript" in favor of language="javascript"
</FAQENTRY>

Not sure on a wording, but its seen a lot here :-(
var ua = navigator.userAgent.toLowerCase();

// Browsers: Netscape has a lot of impostors


Netscape is not the only one with imposters. Most are imposters of Mozilla
though.

bNN = (ua.indexOf('mozilla') != -1 && ua.indexOf('compatible') == -1
&&ua.indexOf('opera') == -1 && ua.indexOf('hotjava') == -1
&&ua.indexOf('webtv') == -1 && ua.indexOf('spoofer') == -1);

bIE = (ua.indexOf('msie') != -1 && ua.indexOf('opera') == -1);


AOL passes the bIE test, but you won't open a document this way in it.

The browser is irrelevant. The test for ActiveXObject suffices. Browsers that
support it (whether IE or not) will support it, those that don't will move on
to the else, again making the browser detection nothing more than an extra set
of un-needed code.

Consult the group FAQ with regards to Browser Detection.

// Whenever I include the following two lines, the program wouldn't
run, and I saw "Error on Page" at the left bottom corner, right above
the Toolbar. What's wrong with the following two lines?


Double click on the Yellow ! and it will show you an exact error message
(although the solution to it has already been posted) and on the error window,
check the "Always show this message" checkbox.

Jul 20 '05 #5

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

Similar topics

5
by: Paul | last post by:
I've bought two books on CSS, and found they're no good. Now I'm reading "Cascading Style Sheets, level 2 revision 1 CSS 2.1 Specification" , but it's tough going. I have lots of questions about...
3
by: sieg1974 | last post by:
Hi, I have made this simple program to understand char ** pointers, but I still having many questions. int main() { char ** testPointerPointerChar = 0; char * A = "string01";
8
by: V.Ch. | last post by:
In near future I can face a prospect of writing some stuff in C. Being a C++ programmer, I've got practically no experience in C. I'd be obliged if someone could answer the following questions...
5
by: James S. Singleton | last post by:
Thanks to everybody who provided an answer to my previous question on this. I am trying to grasp the nitty-gritty details of this, and I am having difficulties understanding some of the issues...
4
by: Steve | last post by:
I have read a couple articles online, read my Jesse Liberty book but I am still confused as to just what the best practices are for using exceptions. I keep changing how I'm working with them and...
11
by: Gérard Talbot | last post by:
Hello, <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <title></title> <style type="text/css"> body {background-color: white; color: black;}...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
3
by: JJ | last post by:
I've done a little multi-threading on winform apps some time ago now, so I'm not a complete beginner, but best assume I am for any explanations..: This is an asp.net 2.0 website, using c#: I...
5
by: feverzsj | last post by:
STL sort() as an implementation of introsort, below is the code snippet from the gnu stl. template<typename _RandomAccessIterator, typename _Size> void __introsort_loop(_RandomAccessIterator...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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...
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...

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.