define an href into a JS function?

Discussion in 'Web Design & Coding' started by Tinman, Jul 9, 2005.

  1. Tinman

    Tinman OSNN One Post Wonder

    Messages:
    4
    I found a script on this site, which was what I have been searching for , for a long time.
    it's posted here:
    http://www.osnn.net/articles.php?action=show&showarticle=47#programlaunch

    the href of the code is:
    <a onClick="exec('sol.vbs'); return false;" href="java script:void(0)">Launch Solitare</a>

    I would like another JS file to call that line of code.

    so am wondering how to define that line as a JS function.
    I am stuck on this one, anyone willing to help?
    Thanks ion advance to all who reply.
    Tin.

     
  2. Tinman

    Tinman OSNN One Post Wonder

    Messages:
    4
    Ok this is what I have figured out:

    javascript:exec('switchuser.vbs') added into my navbar program

    <a onClick="exec('switchuser.vbs'); return false;" href="javascript:void
    (0)">Switch User</a>
    added into my html

    both lines work in all users
    BUT
    the javascript line will not work with MS "active desktop" in any of the user accounts.
    I receive an "error" window:
    a runtime error has occurred
    line 0
    error:eek:bject expected
    I also get another browser window popping up with javascript:exec('switchuser.vbs')
    in the address bar.

    if I open up my browser (IE6 SP2) with my "home page" set as c:\mywebsite\index.htm
    both lines ( the JS and the href ) will work fine for any user account.
    so I am not really sure where my problem lies here.
    I would expect that it's "active desktop" issue but am not sure why I am getting a runtime error.
    Any thoughts?
    Thank you,
    Ryan.