javascript, frames and opening files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonathan Rubke

    javascript, frames and opening files

    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=doc ument.Page.Lett er[i].value}}
    for (var j=0; j<document.Page .Artist.length; j++) {
    if (document.Page. Artist[j].checked){
    var SecondLetter=do cument.Page.Art ist[j].value}}
    var OpenMe=FirstLet ter+"/"+SecondLetter+ FirstLetter+".h tml";
    parent.list.loc ation=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.


  • Michael Winter

    #2
    Re: javascript, frames and opening files

    On Wed, 11 Feb 2004 23:22:19 -0600, Jonathan Rubke
    <hawkeye1701@ho tmail.com> wrote:
    [color=blue]
    > 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.[/color]

    [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.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    Working...