Jump to content
Killersites Forums

JavaScript Button cannot open another html file. Why?


Recommended Posts

Hello all,

 

I am trying to set up an onclick function in Javascript that opens another html file.

Below there are a few examples of the code used and the error messages they received.

 

Please note that it must be a button not a hyperlink and also it needs to be the genuine file that opens not a popup window.

 

I cannot fathom why a simple request to open a file with a button should be such a problem!

 

Can anyone assist please?

 

THE FOLLOWING CODE



function openFile() 
{
   file.open(C:\Documents and Settings\Administrator\My Documents\abbtweb\disclaimer.html)
}

GETS ERROR:-

- line 145 Object expected (button line of code)

...

 

THE FOLLOWING CODE



function openFile() 
{
   file.open(disclaimer.html)
}

GETS ERROR:-

- line 227 file is undefined (file.open line of code)

...

 

THE FOLLOWING CODE



function openFile() 
{
   file.open{C:\Documents and Settings\Administrator\My Documents\abbtweb\disclaimer.html}
}

GETS ERRORS:-

- line 227 char 11 expected ; (file.open line of code)

- line 145 Object expected (button line of code)

...

 

THE FOLLOWING CODE



function openFile() 
{
   window.open(disclaimer.html/)
}

GETS ERRORS:-

- line 227 'disclaimer' is undefined (window.open line of code)

...

 

THE FOLLOWING CODE



function openFile() 
{
   window.open(/disclaimer.html/)
}

GETS ERRORS:-

- line 227 Access Denied (window.open line of code)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...