G
Greener
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!
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!