tdavis
06-30-2012, 04:32 PM
Can javascript check for the existence of a file or folder on the local hard drive? I need to modify the following script so that I have six locations rather than three; that is, if a file exists, use these three, else use these three (per the window.open functions in the code below). I found that ASP can do this, but I am not a regular coder, so I am not sure. Any help is appreciated!
<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\asp\introduction.asp")=true then
response.write("File c:\asp\introduction.asp exists!")
else
response.write("File c:\asp\introduction.asp does not exist!")
end if
set fs=nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://intapps.corp.cox.com/apps/icomsgui/ -->
<HTML><HEAD><TITLE>ICOMS GUI Home Page</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type><LINK
rel=stylesheet type=text/css href="icomsgui_files/styles.css">
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
<!-- Opens windows -->
function open_win1()
{
window.open("http://data1gui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
function open_win2()
{
window.open("http://data2gui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
function open_win3()
{
window.open("http://centralgui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
//-->
</SCRIPT>
<META name=GENERATOR content="MSHTML 8.00.6001.19258"></HEAD>
<BODY bgColor=#ffffff>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=786 align=center>
<TBODY>
<TR vAlign=bottom>
<TD height=36 colSpan=3><IMG src="icomsgui_files/header.jpg" width=786
height=35></TD></TR>
<TR>
<TD vAlign=top width=13><IMG src="icomsgui_files/borderlft.jpg" width=10
height=388></TD>
<TD vAlign=top width=760>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=760>
<TBODY>
<TR>
<TD vAlign=top width=399><IMG src="icomsgui_files/coxlogo.jpg"
width=399 height=94></TD>
<TD vAlign=top width=361><IMG src="icomsgui_files/header2.jpg"
width=361 height=22></TD></TR>
<TR vAlign=top>
<TD colSpan=2>
<DIV align=center><IMG src="icomsgui_files/icomslogo.jpg" width=431
height=141></DIV></TD></TR>
<TR>
<TD colSpan=2>
<DIV align=center>
<P class=txtStandard><BR>Please make a selection from the list
below</P><!-- form table -->
<TABLE border=0 cellSpacing=0 cellPadding=0 width=400>
<TBODY>
<TR>
<TD vAlign=top>
<FORM method=post name=form1 action=icomsgui.html>
<TABLE width=400>
<TBODY>
<TR class=txtStandard>
<TD><INPUT onclick=open_win1() value=Data1 type=radio
name=databases> <A
href="javascript:open_win1();">Data1</A> </TD>
<TD><LABEL><INPUT onclick=open_win2() value=Data2
type=radio name=databases> <A
href="javascript:open_win2();">Data2</A></LABEL></TD>
<TD><LABEL><INPUT onclick=open_win3() value=Central
type=radio name=databases> <A
href="javascript:open_win3();">Central</A></LABEL></TD>
</TR>
</TBODY></TABLE></FORM></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top width=16><IMG src="icomsgui_files/borderrgt.jpg" width=16
height=388></TD></TR>
<TR vAlign=top>
<TD height=17 colSpan=3><IMG src="icomsgui_files/borderbtm.jpg" width=786
height=17></TD></TR></TBODY></TABLE>
<P align=center> </P></BODY></HTML>
<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\asp\introduction.asp")=true then
response.write("File c:\asp\introduction.asp exists!")
else
response.write("File c:\asp\introduction.asp does not exist!")
end if
set fs=nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://intapps.corp.cox.com/apps/icomsgui/ -->
<HTML><HEAD><TITLE>ICOMS GUI Home Page</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type><LINK
rel=stylesheet type=text/css href="icomsgui_files/styles.css">
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
<!-- Opens windows -->
function open_win1()
{
window.open("http://data1gui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
function open_win2()
{
window.open("http://data2gui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
function open_win3()
{
window.open("http://centralgui.corp.cox.com","Data1_Database","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=800, height=600")
}
//-->
</SCRIPT>
<META name=GENERATOR content="MSHTML 8.00.6001.19258"></HEAD>
<BODY bgColor=#ffffff>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=786 align=center>
<TBODY>
<TR vAlign=bottom>
<TD height=36 colSpan=3><IMG src="icomsgui_files/header.jpg" width=786
height=35></TD></TR>
<TR>
<TD vAlign=top width=13><IMG src="icomsgui_files/borderlft.jpg" width=10
height=388></TD>
<TD vAlign=top width=760>
<TABLE border=0 cellSpacing=0 cellPadding=0 width=760>
<TBODY>
<TR>
<TD vAlign=top width=399><IMG src="icomsgui_files/coxlogo.jpg"
width=399 height=94></TD>
<TD vAlign=top width=361><IMG src="icomsgui_files/header2.jpg"
width=361 height=22></TD></TR>
<TR vAlign=top>
<TD colSpan=2>
<DIV align=center><IMG src="icomsgui_files/icomslogo.jpg" width=431
height=141></DIV></TD></TR>
<TR>
<TD colSpan=2>
<DIV align=center>
<P class=txtStandard><BR>Please make a selection from the list
below</P><!-- form table -->
<TABLE border=0 cellSpacing=0 cellPadding=0 width=400>
<TBODY>
<TR>
<TD vAlign=top>
<FORM method=post name=form1 action=icomsgui.html>
<TABLE width=400>
<TBODY>
<TR class=txtStandard>
<TD><INPUT onclick=open_win1() value=Data1 type=radio
name=databases> <A
href="javascript:open_win1();">Data1</A> </TD>
<TD><LABEL><INPUT onclick=open_win2() value=Data2
type=radio name=databases> <A
href="javascript:open_win2();">Data2</A></LABEL></TD>
<TD><LABEL><INPUT onclick=open_win3() value=Central
type=radio name=databases> <A
href="javascript:open_win3();">Central</A></LABEL></TD>
</TR>
</TBODY></TABLE></FORM></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top width=16><IMG src="icomsgui_files/borderrgt.jpg" width=16
height=388></TD></TR>
<TR vAlign=top>
<TD height=17 colSpan=3><IMG src="icomsgui_files/borderbtm.jpg" width=786
height=17></TD></TR></TBODY></TABLE>
<P align=center> </P></BODY></HTML>