By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,798 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,798 IT Pros & Developers. It's quick & easy.

javascript, frames and opening files

P: n/a
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[i].checked){
var FirstLetter=document.Page.Letter[i].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.
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 11 Feb 2004 23:22:19 -0600, Jonathan Rubke
<ha*********@hotmail.com> wrote:
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

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.