Solved

What is wrong with this Javascript?

Posted on 2006-07-14
18
251 Views
Last Modified: 2009-07-29
Hi

I have a javascript which was generated by a PDF to HTML tool.  The produced HTML files work fine when I run them locally on my PC.  Also they work fine when I run via the server NOT by url but by going directly to the  folder on the server, i.e \\myServer\wwwroot\myfiles\file.html.  However when access the same file via the url, the files load OK but there is a javascript that gets called when a print button is clicked.  This javascript is coming with an error (ONLY WHEN I ACCESS THE FILES VIA THE URL!!) which makes me think it is either IIS or something else on the server.  Portion of the Javascript is below highlighting failing line

The error is "invliad procedure call or argument"

Hope someone knows what the problem is

Thanks

=================================================
var gTimerID = null;
var gTimerRunning = false;
var gTimerDelay = 10;
var gFoundSearchItem;
var gTextFromPage;
var gAbortPrint;

var gResultsText;

var gBeginRange;
var gEndRange;

var framesWindowReference;


var win;

      if (typeof window.opener.parent.main != 'undefined')
            win = window.opener.parent.main;
      else
            win = window.opener;




//-------------------------------------------------------------------------------
// More Globals

      URL_Data = getURLData();  // get URL string
      setPrefFromURL(URL_Data);

//-------------------------------------------------------------------------------


function resizePages() {

    var number;
    var el;
    var zoomVal = .75;
    var currentFrame = 0;

      for (var j=gBeginRange; j<=gEndRange; j++) {

            if (!framesWindowReference.frames[currentFrame].document.styleSheets) return;
            var mycss = new Array();
            if (framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules)      // Mozilla         <--  FAILING ON THIS LINE
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules;
            else
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].rules;  // IE

            for(x=0;x<mycss.length;x++){
                if (x==0){
                        mycss[x].style.width = '0px';
                        mycss[x].style.height = '0px';
                  } else {
                        if (mycss[x].style.left != '') mycss[x].style.left = (parseFloat(mycss[x].style.left) * zoomVal) + 'px';
                        if (mycss[x].style.width != '') mycss[x].style.width = (parseFloat(mycss[x].style.width) * zoomVal) + 'px';
                        if (mycss[x].style.top != '') mycss[x].style.top = (parseFloat(mycss[x].style.top) * zoomVal) + 'px';
                        if (mycss[x].style.fontSize != '')  mycss[x].style.fontSize = (parseFloat(mycss[x].style.fontSize) * zoomVal+0.5) + 'px';
                  }

            }

              var imgarr = framesWindowReference.frames[currentFrame].document.getElementsByTagName("IMG");
              for (var i = 0; i < imgarr.length; i++) {
                  if (imgarr[i].name == "") {
                  imgarr[i].height = imgarr[i].height * zoomVal;
                  imgarr[i].width = imgarr[i].width * zoomVal;
                  }
              }
      currentFrame++;
      } // for all frames

}
0
Comment
Question by:gbzhhu
  • 9
  • 7
  • 2
18 Comments
 
LVL 17

Expert Comment

by:gops1
ID: 17107182
I guess there is some link to .js file inside your html whose path would have been given wrong.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17107365
Thanks for your comment gops1

I am looking through the files but can you explain your assumption.  How can the path be right when I am accessing server directly and not right when I use URL.  Pls note I am new to web development
0
 
LVL 17

Expert Comment

by:gops1
ID: 17107575
Path referencing matters when you access something from web and local
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17107633
Please show the html (from view-source) including the frameset if any
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17107654
I understand that but I am not sure if this is path related.  I narrowed the problem to these lines.  

First line is OK, so the issue is not framesWindowReference variable
Second line is fine too

I don't know what it is doing but it looks like it doesn't like the styleSheets[0].cssRules either because of the array element reference or maybe the cssRules.  Do you know what the line is trying to do

            if (!framesWindowReference.frames[currentFrame].document.styleSheets) return;
            var mycss = new Array();
            if (framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules)      // Mozilla
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules;
            else
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].rules;  // IE
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17107680
Problems might be
1. frameset contents loaded from different domain than the browser will allow
2. stylesheet not loaded
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17107692
mplungjan

I don't know how to show the html because the first page contains a button (print) when I click on it it opens a new window with no menus or toolbars and right click is disabled.  In the new window is another button (also print) on clicking that causes the error
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17107716

>>1. frameset contents loaded from different domain than the browser will allow

The server is in the same domain as my PC

>>2. stylesheet not loaded
What does this mean?  I don't know much about style sheets.  How could I fix this?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17107924
make sure the stylesheet does not give a 404 when you load it in the browser

I cannot help more without seeing the html
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 12

Author Comment

by:gbzhhu
ID: 17108143
OK.  I took the mouse disabling code and now got the html.  Here we go

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Print</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script src="global.js"></script>
<script src="scripts.js"></script>
<script language="JavaScript">
<!--
function clickHere() {
      if (event.button == 2) {
            window.alert("Sorry, this function is disabled.");
      }
}
//document.onmousedown = clickHere;
//-->
</script>
<script>
///////////////////////////////////////////////////
//
//         Magellan Navigation Script 6.5
//
//          Copyright BCL Technologies
//             All Rights Reserved
//
//     This Code My Not Be Duplicated Without
//  The Express Written Consent of BCL Technologies
//
///////////////////////////////////////////////////
// Globals

// SEARCH TIMERS (can't refresh page inside a static loop)
var gTimerID = null;
var gTimerRunning = false;
var gTimerDelay = 10;
var gFoundSearchItem;
var gTextFromPage;
var gAbortPrint;

var gResultsText;

var gBeginRange;
var gEndRange;

var framesWindowReference;


var win;

      if (typeof window.opener.parent.main != 'undefined')
            win = window.opener.parent.main;
      else
            win = window.opener;




//-------------------------------------------------------------------------------
// More Globals

      URL_Data = getURLData();  // get URL string
      setPrefFromURL(URL_Data);

//-------------------------------------------------------------------------------


function resizePages() {

    var number;
    var el;
    var zoomVal = .75;
    var currentFrame = 0;

      for (var j=gBeginRange; j<=gEndRange; j++) {

            if (!framesWindowReference.frames[currentFrame].document.styleSheets) return;
            var mycss = new Array();
            if (framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules)      // Mozilla
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules;
            else
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].rules;  // IE

            for(x=0;x<mycss.length;x++){
                if (x==0){
                        mycss[x].style.width = '0px';
                        mycss[x].style.height = '0px';
                  } else {
                        if (mycss[x].style.left != '') mycss[x].style.left = (parseFloat(mycss[x].style.left) * zoomVal) + 'px';
                        if (mycss[x].style.width != '') mycss[x].style.width = (parseFloat(mycss[x].style.width) * zoomVal) + 'px';
                        if (mycss[x].style.top != '') mycss[x].style.top = (parseFloat(mycss[x].style.top) * zoomVal) + 'px';
                        if (mycss[x].style.fontSize != '')  mycss[x].style.fontSize = (parseFloat(mycss[x].style.fontSize) * zoomVal+0.5) + 'px';
                  }

            }

              var imgarr = framesWindowReference.frames[currentFrame].document.getElementsByTagName("IMG");
              for (var i = 0; i < imgarr.length; i++) {
                  if (imgarr[i].name == "") {
                  imgarr[i].height = imgarr[i].height * zoomVal;
                  imgarr[i].width = imgarr[i].width * zoomVal;
                  }
              }
      currentFrame++;
      } // for all frames

}



//-------------------------------------------------------------------------------


function EnterKey() {
   if (window.event.keyCode == 13)
         printme();
   return !(window.event && window.event.keyCode == 13);
}


//-------------------------------------------------------------------------------


function StartThePrintTimer()                                    // TIMER LOOP
{

   if (gAbortPrint){

       if(gTimerRunning) clearTimeout(gTimerID);
       gTimerRunning = false;
       printform.cancelbutton.value = "Close";

   } else {

                  if  (!framesWindowReference.readyState || framesWindowReference.readyState == "complete") {

                  if (printform.zoomcheck.checked) resizePages();

                  window.alert('Please make sure "print all frames individually" is selected under the options tab in the print dialog.');

                        if (framesWindowReference.print) {
                           framesWindowReference.print();      // WE KNOW THAT ALL THE FRAMES HAVE BEEN SUCCESSFULLY LOADED
                           self.close();
                           framesWindowReference.close();
                        } else
                              window.alert('Please try again...');
                        gAbortPrint = true;
                  }
                  // wait a second for the page to load and try again
                  gTimerRunning = true;
                  printform.cancelbutton.value = "Cancel";
                  gTimerID = self.setTimeout("StartThePrintTimer()", gTimerDelay);

      } // abort search

}


function printme() {

      if (printform.radiobutton[0].checked) {
            gBeginRange = gCurrentPage;
            gEndRange = gCurrentPage;
      }
      if (printform.radiobutton[1].checked) {
            gBeginRange = gStartingPage;
            gEndRange = gTotalPages;
      }
      if (printform.radiobutton[2].checked) {
            gBeginRange = printform.beginpage.value;
            gEndRange = printform.endpage.value;
      }

      if (printform.cancelbutton.value == "Cancel") {
            gAbortPrint = true;
      } else {

            framesWindowReference = window.open('#','PrintBuffer','width=300,height=90,toolbar=no, status=no,menubar=no,location=no,directories=no,resizable');
            if (framesWindowReference)
            {
                  if ( (gEndRange-gBeginRange) > 4)
                  {
                        window.alert('Pages '+gBeginRange+' - '+gEndRange+' will be loaded into the print buffer.\nThis process may take a few moments to complete...');
                  }

                  framesWindowReference.document.open();
                  framesWindowReference.document.write(' <html><head><title>Print Buffer...</title></head><frameset name = "allPrintFrames" rows="*');
                        for (var i=gBeginRange; i<=(gEndRange-1); i++) {
                              framesWindowReference.document.write(',*');
                        }
                        framesWindowReference.document.write('" frameborder="no" framespacing=0> ');
                        for (var j=gBeginRange; j<=gEndRange; j++) {
                              framesWindowReference.document.write('<frame name="printframe' + j +'"  src = "'+gsFName+'_'+j+gsExtName+'?gShowToolbar=0" scrolling="no" marginheight=0 marginwidth=0>');
                        }
                        framesWindowReference.document.write(' </frameset></html>');
                  framesWindowReference.document.close();
                  printform.cancelbutton.value = "Cancel";

                  gTimerID = setTimeout("StartThePrintTimer()", gTimerDelay);
            }else
            {
                  window.alert ("encountered problems while printing ...");
            }
            //StartThePrintTimer();                                    // START THE CLOCK
      }

}


function cancelSearch() {
      if (printform.cancelbutton.value == "Close") {
            gAbortPrint = true;
            if(gTimerRunning) clearTimeout(gTimerID);
            gTimerRunning = false;
            if (framesWindowReference!=null)      framesWindowReference.close();
            window.close();
      }
      if (printform.cancelbutton.value == "Cancel") printme();
}



function SetPrintProperties() {
       var x;
     x = new ActiveXObject("WScript.Shell")
     x.SendKeys("+(%fu)");
}


</script>

<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >

<script>
      document.bgColor = gColor;
</script>


<div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">  </font></strong>
  <form name="printform" method="post" action="">
  <strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
  Print</font></strong><br>
  <br>
  <table border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
      <td><table border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td valign="top" nowrap><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
            <input name="radiobutton" type="radio" value="currentradio" checked>
                  Current Page<br>
            </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
            <input type="radio" name="radiobutton" value="allradio">
                  All Pages</font><br>
      <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
        <input type="radio" name="radiobutton" value="rangeradio">
        Page Range:
              <script>
                    document.write('<input onChange="printform.radiobutton[2].checked=true" name="beginpage" type="text" style="color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;top: 0px;font-size: 9px;background-color: #FFFFFF;height: 16px; border: 1px solid #0000FF;" onKeyPress=JavaScript:return EnterKey()" value="'+gStartingPage+'" size="4" maxlength="4">');
              </script>
              to
              <script>
                  document.write('<input onChange="printform.radiobutton[2].checked=true" name="endpage" type="text" style="color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;top: 0px;font-size: 9px;background-color: #FFFFFF;height: 16px; border: 1px solid #0000FF;" onKeyPress="JavaScript:return EnterKey()" value="'+gTotalPages+'" size="4" maxlength="4">');
            </script>

      </font></div>
          </td>
          <td valign="top" nowrap> <font color="#0000FF" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>                note</strong></font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">:
              It may take a few moments to print <br>
              multiple pages
              because each
              page  must
              <br>
              pre-load and resize. </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> Note
      that you can remove
<br>
header and footer text in <a href="#" onclick="window.opener.SetPrintProperties();" >Page Setup</a>.</font></td>
        </tr>
        <tr>
          <td nowrap><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input name="zoomcheck" type="checkbox" value="checkbox" checked>
              <font size="1" face="Verdana, Arial, Helvetica, sans-serif"> resize
              contents to fit page</font>&nbsp; </font></div>
          </td>
          <td nowrap><div align="right">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="50" height="24" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC">
                  <tr>
                    <td valign="middle"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a onClick="printme()" href="JavaScript:void('Print')">
                    <script>
                    document.write('<img src="'+gImagePath+'print.gif" align="absbottom" alt="Print" border="0">');
                    </script>

                    </a></font></div></td>
                  </tr>
                </table></td>
                <td>&nbsp;&nbsp;<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                  <input onClick="cancelSearch()" type="button" name="cancelbutton" value="Close">
</font></td>
              </tr>
            </table>
            <font size="1" face="Verdana, Arial, Helvetica, sans-serif">            </font></div>
          </td>
        </tr>
      </table></td>
    </tr>
  </table>
  </form>
</div>
</body>
</html>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17108630
That shows you want to get to the stylesheet of a frame in a popup.

framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules

So what is in the popup, does it have a stylesheet and is it loaded...
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17108827

>>So what is in the popup, does it have a stylesheet and is it loaded...

The popup gets loaded like this

document.writeln('  <a href="JavaScript:void(\'Print\')"><img onClick="findwin = window.open(\'print'+gsExtName+'?currentpage='+currentPage+'&totalpages='+gTotalPages+'\',\'Print\',\'width=600,height=200,toolbar=no, status=no,menubar=no,location=no,directories=no,resizable\');" name="print" src="'+gImagePath+'print.gif" align="absmiddle" alt="Print" border="0"></a>');  


I don't know how to tell if it has stylesheet or not and whether it is loaded or not.  The whole code for the popup page is here

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Print</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script src="global.js"></script>
<script src="scripts.js"></script>
<script language="JavaScript">
<!--
function clickHere() {
      if (event.button == 2) {
            window.alert("Sorry, this function is disabled.");
      }
}
document.onmousedown = clickHere;
//-->
</script>
<script>
///////////////////////////////////////////////////
//
//         Magellan Navigation Script 6.5
//
//          Copyright BCL Technologies
//             All Rights Reserved
//
//     This Code My Not Be Duplicated Without
//  The Express Written Consent of BCL Technologies
//
///////////////////////////////////////////////////
// Globals

// SEARCH TIMERS (can't refresh page inside a static loop)
var gTimerID = null;
var gTimerRunning = false;
var gTimerDelay = 10;
var gFoundSearchItem;
var gTextFromPage;
var gAbortPrint;

var gResultsText;

var gBeginRange;
var gEndRange;

var framesWindowReference;


var win;

      if (typeof window.opener.parent.main != 'undefined')
            win = window.opener.parent.main;
      else
            win = window.opener;




//-------------------------------------------------------------------------------
// More Globals

      URL_Data = getURLData();  // get URL string
      setPrefFromURL(URL_Data);

//-------------------------------------------------------------------------------


function resizePages() {

    var number;
    var el;
    var zoomVal = .75;
    var currentFrame = 0;

      for (var j=gBeginRange; j<=gEndRange; j++) {

            if (!framesWindowReference.frames[currentFrame].document.styleSheets) return;
            var mycss = new Array();
            if (framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules)      // Mozilla
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].cssRules;
            else
               mycss = framesWindowReference.frames[currentFrame].document.styleSheets[0].rules;  // IE

            for(x=0;x<mycss.length;x++){
                if (x==0){
                        mycss[x].style.width = '0px';
                        mycss[x].style.height = '0px';
                  } else {
                        if (mycss[x].style.left != '') mycss[x].style.left = (parseFloat(mycss[x].style.left) * zoomVal) + 'px';
                        if (mycss[x].style.width != '') mycss[x].style.width = (parseFloat(mycss[x].style.width) * zoomVal) + 'px';
                        if (mycss[x].style.top != '') mycss[x].style.top = (parseFloat(mycss[x].style.top) * zoomVal) + 'px';
                        if (mycss[x].style.fontSize != '')  mycss[x].style.fontSize = (parseFloat(mycss[x].style.fontSize) * zoomVal+0.5) + 'px';
                  }

            }

              var imgarr = framesWindowReference.frames[currentFrame].document.getElementsByTagName("IMG");
              for (var i = 0; i < imgarr.length; i++) {
                  if (imgarr[i].name == "") {
                  imgarr[i].height = imgarr[i].height * zoomVal;
                  imgarr[i].width = imgarr[i].width * zoomVal;
                  }
              }
      currentFrame++;
      } // for all frames

}



//-------------------------------------------------------------------------------


function EnterKey() {
   if (window.event.keyCode == 13)
         printme();
   return !(window.event && window.event.keyCode == 13);
}


//-------------------------------------------------------------------------------


function StartThePrintTimer()                                    // TIMER LOOP
{

   if (gAbortPrint){

       if(gTimerRunning) clearTimeout(gTimerID);
       gTimerRunning = false;
       printform.cancelbutton.value = "Close";

   } else {

                  if  (!framesWindowReference.readyState || framesWindowReference.readyState == "complete") {

                  if (printform.zoomcheck.checked) resizePages();

                  window.alert('Please make sure "print all frames individually" is selected under the options tab in the print dialog.');

                        if (framesWindowReference.print) {
                           framesWindowReference.print();      // WE KNOW THAT ALL THE FRAMES HAVE BEEN SUCCESSFULLY LOADED
                           self.close();
                           framesWindowReference.close();
                        } else
                              window.alert('Please try again...');
                        gAbortPrint = true;
                  }
                  // wait a second for the page to load and try again
                  gTimerRunning = true;
                  printform.cancelbutton.value = "Cancel";
                  gTimerID = self.setTimeout("StartThePrintTimer()", gTimerDelay);

      } // abort search

}


function printme() {

      if (printform.radiobutton[0].checked) {
            gBeginRange = gCurrentPage;
            gEndRange = gCurrentPage;
      }
      if (printform.radiobutton[1].checked) {
            gBeginRange = gStartingPage;
            gEndRange = gTotalPages;
      }
      if (printform.radiobutton[2].checked) {
            gBeginRange = printform.beginpage.value;
            gEndRange = printform.endpage.value;
      }

      if (printform.cancelbutton.value == "Cancel") {
            gAbortPrint = true;
      } else {

            framesWindowReference = window.open('#','PrintBuffer','width=300,height=90,toolbar=no, status=no,menubar=no,location=no,directories=no,resizable');
            if (framesWindowReference)
            {
                  if ( (gEndRange-gBeginRange) > 4)
                  {
                        window.alert('Pages '+gBeginRange+' - '+gEndRange+' will be loaded into the print buffer.\nThis process may take a few moments to complete...');
                  }

                  framesWindowReference.document.open();
                  framesWindowReference.document.write(' <html><head><title>Print Buffer...</title></head><frameset name = "allPrintFrames" rows="*');
                        for (var i=gBeginRange; i<=(gEndRange-1); i++) {
                              framesWindowReference.document.write(',*');
                        }
                        framesWindowReference.document.write('" frameborder="no" framespacing=0> ');
                        for (var j=gBeginRange; j<=gEndRange; j++) {
                              framesWindowReference.document.write('<frame name="printframe' + j +'"  src = "'+gsFName+'_'+j+gsExtName+'?gShowToolbar=0" scrolling="no" marginheight=0 marginwidth=0>');
                        }
                        framesWindowReference.document.write(' </frameset></html>');
                  framesWindowReference.document.close();
                  printform.cancelbutton.value = "Cancel";

                  gTimerID = setTimeout("StartThePrintTimer()", gTimerDelay);
            }else
            {
                  window.alert ("encountered problems while printing ...");
            }
            //StartThePrintTimer();                                    // START THE CLOCK
      }

}


function cancelSearch() {
      if (printform.cancelbutton.value == "Close") {
            gAbortPrint = true;
            if(gTimerRunning) clearTimeout(gTimerID);
            gTimerRunning = false;
            if (framesWindowReference!=null)      framesWindowReference.close();
            window.close();
      }
      if (printform.cancelbutton.value == "Cancel") printme();
}



function SetPrintProperties() {
       var x;
     x = new ActiveXObject("WScript.Shell")
     x.SendKeys("+(%fu)");
}


</script>

<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >

<script>
      document.bgColor = gColor;
</script>


<div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">  </font></strong>
  <form name="printform" method="post" action="">
  <strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
  Print</font></strong><br>
  <br>
  <table border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
      <td><table border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td valign="top" nowrap><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
            <input name="radiobutton" type="radio" value="currentradio" checked>
                  Current Page<br>
            </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
            <input type="radio" name="radiobutton" value="allradio">
                  All Pages</font><br>
      <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
        <input type="radio" name="radiobutton" value="rangeradio">
        Page Range:
              <script>
                    document.write('<input onChange="printform.radiobutton[2].checked=true" name="beginpage" type="text" style="color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;top: 0px;font-size: 9px;background-color: #FFFFFF;height: 16px; border: 1px solid #0000FF;" onKeyPress=JavaScript:return EnterKey()" value="'+gStartingPage+'" size="4" maxlength="4">');
              </script>
              to
              <script>
                  document.write('<input onChange="printform.radiobutton[2].checked=true" name="endpage" type="text" style="color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;top: 0px;font-size: 9px;background-color: #FFFFFF;height: 16px; border: 1px solid #0000FF;" onKeyPress="JavaScript:return EnterKey()" value="'+gTotalPages+'" size="4" maxlength="4">');
            </script>

      </font></div>
          </td>
          <td valign="top" nowrap> <font color="#0000FF" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>                note</strong></font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">:
              It may take a few moments to print <br>
              multiple pages
              because each
              page  must
              <br>
              pre-load and resize. </font><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> Note
      that you can remove
<br>
header and footer text in <a href="#" onclick="window.opener.SetPrintProperties();" >Page Setup</a>.</font></td>
        </tr>
        <tr>
          <td nowrap><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
              <input name="zoomcheck" type="checkbox" value="checkbox" checked>
              <font size="1" face="Verdana, Arial, Helvetica, sans-serif"> resize
              contents to fit page</font>&nbsp; </font></div>
          </td>
          <td nowrap><div align="right">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="50" height="24" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC">
                  <tr>
                    <td valign="middle"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a onClick="printme()" href="JavaScript:void('Print')">
                    <script>
                    document.write('<img src="'+gImagePath+'print.gif" align="absbottom" alt="Print" border="0">');
                    </script>

                    </a></font></div></td>
                  </tr>
                </table></td>
                <td>&nbsp;&nbsp;<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                  <input onClick="cancelSearch()" type="button" name="cancelbutton" value="Close">
</font></td>
              </tr>
            </table>
            <font size="1" face="Verdana, Arial, Helvetica, sans-serif">            </font></div>
          </td>
        </tr>
      </table></td>
    </tr>
  </table>
  </form>
</div>
</body>
</html>




0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17113682
That looks strange.
The popup code is the same as the opener?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17120519
I have no clue.  the code was generated by a tool which converts PDF to HTML.  In short:-

1.  Code works fine from my PC as well as on the server when I access server like \\servername\wwwroot\file.html but fails when I access server as www.serverdomain.co.uk/file.html
2.  If I comment out the 2 lines that are trying to load stylesheets everything works fine

Sorry I am not of much help as my knowledge of javascript or web dev generally is poor
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 17120564
So the solution seems to be to comment out those two lines...
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17120599
Yes.  I am not sure even if I need them and why.  I will have to see if they affect the resulting print out.  Ideally, the solution would be to know why they are failing, especially on particular situations.  But this world is not always ideal ;-(.  I will give it a couple of days to see if anyone can actually figure out the whys then I will have to as a last resort comment the lines out

Cheers
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 17120654
As I said. Most likely they are looking for a stylesheet that is not there...

I do not see any stylesheet in any of the code you have shown. Also I do not see where you load the pages to be printed which are the ones that migh have a non-uploaded stylesheet.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 17362459
Asked the company that produced the component for support, but no reply :-(  Just commented the 2 lines and there seems to be no problem

Thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now