0

Happy Monday to all.

I am writing some very basic code to create a web page where my users can go, choose an item out of a drop down list, and then a file downloads base don your choice.

After some help I was able to get this working via jquery in the onchange event of the drop down box. I about did cartwheels when I got it to work in Firefox and then Chrome. I went to IE8 and bam!!! It doesn't work. This is pretty much par for the course.

This is my first experience with any type of javascript. I apologize for the seemingly simple question, but let me tell you it's driving me bananas!!

Here is the code

<html>
<head>
<script script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.
js">   
 $(function() {
     $("#PrinterNames").change(function() {
         var printer = $(this).val();
         var url = "file:///C:/Users/JBenson/Desktop/PrinterScripts 

         /Completed"+"/"+ printer +".vbs";
     console.log(url);
         window.open(url,'Start Installation')
     });
});
</script>      
</head>

<body lang=EN-US style='tab-interval:.5in'>

<img src=inspirelogo.gif>

<H2>Welcome to the HK Printer Installation Page!</H2>
      <H3>Please select a printer:
            <select id ="PrinterNames"  name ="PrinterNames" >
          <option value="Please Select a Printer" selected="selected">
 Please  Select a Printer</option>
          <option value="Acadia">Acadia</option>
                  <option value="Altima">Altima</option>
                  <option value="Armada">Armada</option>
                  <option value="Avalon">Avalon</option>
                  <option value="Blazer">Blazer</option>
                  <option value="Camaro">Camaro</option>
                  <option value="Caravan">Caravan</option>
                  <option value="Cavalier">Cavalier</option>
                  <option value="Celica">Celica</option>
                  <option value="Charger">Charger</option>
                  <option value="Chevelle">Chevelle</option>
                  <option value="Corolla">Corolla</option>
                  <option value="Corvair">Corvair</option>
                  <option value="Corvette">Corvette</option>
                  <option value="Daytona">Daytona</option>
                  <option value="Envoy">Envoy</option>
                  <option value="Escalade">Escalade</option>
                  <option value="Frontier">Frontier</option>
                  <option value="HHR">HHR</option>
                  <option value="Hummer">Hummer</option>      
                  <option value"Impala">Impala</option>
                  <option value="Insight">Insight</option>
                  <option value="Intrepid">Intrepid</option>
                  <option value="Journey">Journey</option>
                  <option value="Malibu">Malibu</option>
                  <option value="Maxima">Maxima</option>
                  <option value="Murano">Murano</option>
                  <option value="Neon">Neon</option>
                  <option value="Nomad">Nomad</option>
                  <option value="Nova">Nova</option>
                  <option value="Prowler">Prowler</option>
                  <option value="Sentra">Sentra</option>
                  <option value="Skyline">Skyline</option>
                  <option value="SSR">SSR</option>
                  <option value="Stratus">Stratus</option>
                  <option value="Versa">Versa</option>
                  <option value="Xterra">Xterra</option>

             </select> </H3>

<H3>Steps for Printer Installation </H3>
<ol>
      <li>Select your printer from the drop down above.</li>
      <li>You will get a pop up window that looks like this<br>
      <img src="printerinstall.jpg" alt="Download Box" ><br>
      Please click on open. It will iniate the installation.<br></li>
      <li>You may see a pop up box that looks like this during your installation<br>
      <img src="trustprinter.jpg" alt="Trust Printer"><br>
      Click on Install driver. <br></li>
      <li>After a few minutes, check your Devices and Printers and the printer you    

      selected should now be there.</li>
</ol>
<H3>Please contact the helpdesk at 6657 if you encounter any issues. </H3>

</body>
</html>

I am hoping this is something really simple that you need for IE. Any help you can provide would be so very appreciated. I am so tired of this issue I could throw the compy through a window.

Thanks again all!

7
  • 1
    Potentially stupid question: Do you actually need to support IE8? Commented Mar 26, 2012 at 13:36
  • Can you give us more information on how it doesn't work? Script error, wrong result, etc.? Commented Mar 26, 2012 at 13:37
  • Yeah we do actually have to support IE8. The outside vendors we deal with have sites and applications on their sites that work only in IE7 and IE8 so we have to keep it. I would change EVERYONE to firefox if I could. Commented Mar 26, 2012 at 14:19
  • Well Rup usually, on Firefox, when you choose and item from the drop down box, a box comes up for the download asking if you want to save, run, etc. In IE8, you select the item and nothing happens. I haven't run the debugging yet. Commented Mar 26, 2012 at 14:20
  • Just as a quick note as well, I'm doing this all through Notepad. My company wanted this and just kind of shoved it on my desk since I knew how to program C# and VB and the like. So unless I run it threw web tools, I have no debugging, just as a note. Commented Mar 26, 2012 at 14:36

1 Answer 1

1

Try taking out:

console.log(url);

IE8 may spit up on console.

And, remember to include semicolons at the end of lines where they are appropriate. IE is not forgiving of JS errors like other browsers may be.

Run the code through JSLint or other JS debugger.

Here is a fiddle of your code to try: http://jsfiddle.net/WmS25/

Sign up to request clarification or add additional context in comments.

6 Comments

In addition: Check this debug script. benalman.com/projects/javascript-debug-console-log Instead of using console.log(url); you'd just use debug.log(url). It gives you a ton of options, and works across all browsers.
jk. Ran the code through jslint. Again having no experience with javascript not sure if the errors I am getting are what is causing the issue or if it's just being picky about syntax? Could y'all take a look and tell me if these errors would cause this issue?
@JamiBenson I tested the console.log in IE8 on my own code and it did not run. Always use proper JS syntax as IE is particularly sensitive. Also, Chrome has JS debug tools built in. Wrench upper left, Tools, Javascript console.
@JamiBenson Added a fiddle to my answer. You can run the fiddle link in any browser you want to test. It has JSLint built in.
@JK Thanks so much for the fiddle. I had never seen that before. Cool stuff. I ran it in evil IE8 and it says my JS code is valid. Only found one error I corrected. I hate to be such a pain, but do you have any other thoughts? Thanks again so much for your help. I appreciate it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.