www.webdeveloper.com
Results 1 to 6 of 6

Thread: Error in Internet Explorer only

  1. #1
    Join Date
    Mar 2005
    Posts
    13

    Error in Internet Explorer only

    I m using the following code to allow me to print multiple coupons on one page. This works great except for when I use IE (any version?) - then I get the error (see attachment):

    ie-script-error.jpg

    Code:
    <style type="text/css">
    @media print {
        .noprint { display: none; }
        .printme { display: block; }
    }
    
    #vehicleOfTheMonth {
        width: 650px;
    }
    
    .script-errors {
    	width: 650px;
    	font-family: Verdana, Geneva, sans-serif;
    	font-size: 11px;
    }
    </style>
    
    <script type="text/javascript">
    function printDiv( byId )
    {
        // this loop could use getElementByClassName if not using MSIE8 and below
        var divall = document.getElementsByTagName("div");
        for ( var d = 0; d < divall.length; ++d )
        {
            var div = divall[d];
            div.className = div.className.replace("printme","noprint");
        }
        // now, turn "on" only one div for printing:
        var div = document.getElementById( byId );
        div.className = div.className.replace("noprint","printme");
        window.print( );
    }
    </script>
    
    </head>
    <body>
    <div class="script-errors"><span style="font-weight:bold">Please note:</span>  Some versions of Internet Explorer may give script errors when trying to print.  You should still be able to print - just ignore this error please. (Otherwise, please use Firefox, Chrome, Safari or Opera)</div>
    <!--script errors-->
    
    
    
    <div id="vehicleOfTheMonth" class="noprint">
       <p><img src="parts/vehicle-of-the-month.jpg" width="650" height="700">
         <span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#F00; font-weight:bold;">Please print this coupon and present to dealer at time of purchase</span><br /><br />
         <input type="button" value="Print Coupon" onClick="printDiv('vehicleOfTheMonth');"/>
       </p>
       <p>&nbsp;</p>
    </div>
    
    
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Posts
    13
    Wow...over 180 views and not one person able to help

  3. #3
    Join Date
    Mar 2011
    Posts
    1,137
    The error message says the problem is on line 75, so which is line #75 in your original code? That should give you a good start.
    Rick Trethewey
    Rainbo Design

  4. #4
    Join Date
    Feb 2013
    Posts
    11
    I think Internet Explorer is very slow browser.
    It's take more time to open page or downloading video or other

  5. #5
    Join Date
    Mar 2005
    Posts
    13
    Here where it gets interesting...there seems to be no line 75 (Full source code below)

    Here is the URL where you can see the page: http://harrisftp.com/mazda/coupons/service.php

    Code:
    <html>
    <head>
    <style type="text/css">
    @media print {
        .noprint { display: none; }
        .printme { display: block; }
    }
    
    #tireRotation {
        width: 650px;
    }
    #oilChange {
        width: 650px;
    }
    .script-errors {
    	width: 650px;
    	font-family: Verdana, Geneva, sans-serif;
    	font-size: 11px;
    }
    </style>
    
    <script type="text/javascript">
    function printDiv( byId )
    {
        // this loop could use getElementByClassName if not using MSIE8 and below
        var divall = document.getElementsByTagName("div");
        for ( var d = 0; d < divall.length; ++d )
        {
            var div = divall[d];
            div.className = div.className.replace("printme","noprint");
        }
        // now, turn "on" only one div for printing:
        var div = document.getElementById( byId );
        div.className = div.className.replace("noprint","printme");
        window.print( );
    }
    </script>
    
    </head>
    <body>
    <div class="script-errors"><span style="font-weight:bold">Please note:</span>  Some versions of Internet Explorer may give script errors when trying to print.  You should still be able to print - just ignore this error please. (Otherwise, please use Firefox, Chrome, Safari or Opera)</div>
    <!--script errors-->
    <div id="tireRotation" class="noprint">
       <p><img src="service/tire-rotation.jpg" width="650" height="500">
         <span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#F00; font-weight:bold;">Please print this coupon and present prior to service.</span><br /><br />
         <input type="button" value="Print Coupon" onClick="printDiv('tireRotation');"/>
       </p>
       <p>&nbsp;</p>
    </div>
    
    <div id="oilChange" class="noprint">
       <p><img src="service/oil-change.jpg" width="650" height="500"><span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#F00; font-weight:bold;">Please print this coupon and present prior to service.</span><br /><br />
         <input type="button" value="Print Coupon" onClick="printDiv('oilChange');"/>
       </p>
       <p>&nbsp;</p>
    </div>
    
    
    </body>
    </html>

  6. #6
    Join Date
    Mar 2005
    Posts
    13
    My bad....

    The link i sent in the previous message works fine with no errors. I get the errors when I "I-Framed" it in at: http://www.harrismazdaservice.ca/service-parts/coupons

    Would the i-framing cause this? If so, any work around?

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