javascript, frames and opening files

J

Jonathan Rubke

I am getting a filename from one frame and opening it in another frame. It
works fine if the file exists, but I'm trying to get it to show an error
message, possibly an alert box, if the file doesn't exist. Right now, if it
doesn't exist it just gives a error "page not found" in the frame I'm trying
to open it in. Here is my code.

function PullPage()
{
for (var i=0; i<document.Page.Letter.length; i++) {
if (document.Page.Letter.checked){
var FirstLetter=document.Page.Letter.value}}
for (var j=0; j<document.Page.Artist.length; j++) {
if (document.Page.Artist[j].checked){
var SecondLetter=document.Page.Artist[j].value}}
var OpenMe=FirstLetter+"/"+SecondLetter+FirstLetter+".html";
parent.list.location=OpenMe;
}

"list" is the frame I'm trying to open it in. The page has two sets of
radio buttons, in arrays, to choose from. The file name is based on the
radio buttons they choose. "artist" is one array of radio buttons, "letter"
is the other array of radio buttons. If anyone can help me with this, it
will be greatly appreciated.
 
M

Michael Winter

I am getting a filename from one frame and opening it in another frame.
It works fine if the file exists, but I'm trying to get it to show an
error message, possibly an alert box, if the file doesn't exist. Right
now, if it doesn't exist it just gives a error "page not found" in the
frame I'm trying to open it in.

[snip]

You can't use JavaScript to detect missing files. You would need to read
the HTTP Status-Line and check for 404, and JavaScript is unable to do
this.

Mike
 

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

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top