www.webdeveloper.com
Results 1 to 4 of 4

Thread: Open a new instance of Word?

  1. #1
    Join Date
    Sep 2007
    Posts
    22

    Open a new instance of Word?

    I have the link to the file, but can I open an instance of excel from the javascript?
    I tried this, but it doe not open, the page just loops back on its self.

    <script language=javascript TYPE="text/javascript">
    function opendoc(xlink) {
    alert(xlink);
    var myshell = new ActiveXObject("WScript.shell");
    myshell.run( '"c:/program files/microsoft office/office10/winword.exe" ++ xlink', 3, true );
    }
    </script>

    Javascript is stripping the "\" from the link. Hummm.. Any way around this?

    (Javascript writers I'd like to slap for $100 Alex. "Lets use the backslash for the escape code")
    Last edited by Juliemac; 09-30-2007 at 02:10 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    \ is the escape character in JScript so you need to escape it to give it back its regular meaning \\

    Assume that this is for an intranet since Internet Explorer is the only browser to support JScript and those commands have no JavaScript equivalent.
    Stephen

  3. #3
    Join Date
    Sep 2007
    Posts
    22
    I am pulling the link from a database to populate segments of the page. I suppose I could replace the single"\" with the double "\\".
    I'll try it today!

  4. #4
    Join Date
    Sep 2007
    Posts
    22
    I pulled that code from a non dated web page. is there a way to do it in javascript?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles