www.webdeveloper.com
Results 1 to 3 of 3

Thread: What is wrong with my short code?

  1. #1
    Join Date
    Dec 2010
    Posts
    3

    What is wrong with my short code?

    Code:
    <html>
    <head>
    <title>Test Test</title>
    <script type="text/javascript" language="JavaScript">
    
    function LaunchCommand()
    {
    var launcher = new ActiveXObject("WScript.Shell");
    launcher.Run("file:///C:/Program/ColorCop.exe");
    
    window.open('','_self','');
    window.close();
    }
    
    </script>
    </head>
    <body>
    <br>
    
    <center>
    <font size = 5>Click the button</font>
    
    <br><br>
    
    <input name="Command" value="RGB Color"
    onclick="LaunchCommand()" type="button" style="width:200px;height:100px">
    
    <body>
    <center>
    </html>

    Above is a short code which i have written.

    When i tested it in windows XP, the program ColorCop opens when i click the button.
    But in Windows Server 2008, nothing happens when i click the button.

    Any idea why?

    TQ

  2. #2
    Join Date
    Dec 2010
    Posts
    3
    Sorry, i forgot to mention that it is Windows Server 2008 R1.

  3. #3
    Join Date
    May 2011
    Posts
    4
    While I'm no expert I would check these things:

    1) There is a file located at C:/Program/ColorCop.exe on the Windows Server 2008 machine
    2) Javascript is enabled on the browser being used on the machine
    3) The code is actually being run, i.e. an "alert" as the first line in the function gets called

    There are also a bunch of things wrong with your markup:

    1) Your <br> tags should actually be <br />
    2) You have not actually closed the <body> tag.
    3) You have not actually closed the <center> tag.
    4) The attempted closing <center> tag is outside the attempted closing <body> tag.
    5) You have not actually closed the <input> tag.
    6) This (afaik) is not legal syntax, nor is there a size attribute for font, specify the size with the style attribute:
    HTML Code:
    <font size = 5>
    I would also suggest this:
    Validate Markup

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