Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    53
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Print version showing comment end tags

    Hello!
    How can I remove the comment end tags "-->" that are showing up when I view the print version of the page?. Below is the code for the print version script and below that is the code for the article page.

    Code:
    <!-- noprint -->
    <%@ LANGUAGE=VBSCRIPT%>
    <!-- /noprint -->
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
    <HTML>
    <HEAD>
    <TITLE>test</TITLE>
    
    <!-- noprint -->
    
    <LINK REL="stylesheet" TYPE="text/css" HREF="../styles_3.css" TITLE="Default">
    <!-- GOOGLE SEARCH -->
    <script type="text/javascript">
    // Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)
    // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
    // This notice must stay intact for use
    //Enter domain of site to search.
    var domainroot="www.test.org"
    function Gsitesearch(curobj){
    curobj.q.value="site:"+domainroot+" "+curobj.qfront.value
    }
    </script>
    <!-- GOOGLE SEARCH END -->
    
    <!-- /noprint -->
    
    </head>
    <BODY>
    <a name="top"></a>
    <!-- MAIN TABLE -->
    <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F8F8F8">
    <!-- TOP LOGO BANNER -->
    <tr valign="top" align="left">
    <td colspan="3">
    
    <!-- noprint -->
    
    <!--#include virtual ="/includes/top.inc"-->
    
    <!-- /noprint -->
    
    </td>  		
    </tr>
    <!-- TOP LOGO BANNER END -->
    <tr valign="top" align="left">
    <!-- LEFT NAV COLUMN -->
    <td width="160" valign="top">
    
    <!-- noprint -->
    
    <!--#include virtual ="/includes/nav.inc"-->
    <br>
    <p><!--GOOGLE ADSENSE CODE --><!--#include virtual ="/includes/google_ads.inc"--></p>
    
    <!-- /noprint -->
    
    </td>
    <!-- LEFT COLUMN END -->
    <!-- MAIN BODY SECOND COLUMN -->
    <td width="425" valign="top">
    <!-- ARTICLE TABLE -->
    <table width="425" cellpadding="2" cellspacing="2">       	
    <tr><td valign="top">
    <!-- BREADCRUMBS, VERSION 2 -->
    
    <!-- noprint -->
    
    <script language="JavaScript" type="text/JavaScript" src="/MPBackLinks.js"></script>
    
    <!-- /noprint -->
    
    <!-- ARTICLE CONTENT -->
    <h2>Peculiar Star Position</h2>
    <hr>
    
    <!-- noprint -->
    
    <p>
    <%
    aURL=request.serverVariables("PATH_INFO")
    pDom=request.servervariables("HOST")
    pPath=pDom&aUrl
    %>
    <table border="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0">
    <tr><td>
      <a href="print.asp?page=<%=pPath%>"></a></td>
    <td><p><a href="print.asp?page=<%=pPath%>">Click Here for a Print Friendly Version</a>
    </td></tr></table>
    </p>
    
    <!-- /noprint -->
    
    <h3>THIS ISSUE&rsquo;S PUZZLE</h3>
    <p>In a newly found universe, called &ldquo;SML,&rdquo; stars are of only three sizes &mdash; small, medium, and large. There is only one L star, which is 4 &radic;&minus; 3 times as massive as each of the two M stars. Remarkably, centers of all of the stars lie on a single plane, and centers of all of the S stars lie on a straight line. The mass of an M star is 24&pi;2 times that of each of the infinite collection of S stars in the universe.</p>
    <br>
    <p class="footer" align="center"><a href="#top">Back to top</a></p>
    </td></tr>
    <tr><td><br><!--#include virtual ="/includes/article_disclaimer.inc"--><br></td></tr>
    </table>
    <!-- ARTICLE TABLE END -->
    </td>
    <!-- MAIN BODY SECOND COLUMN END -->
    <!-- THIRD COLUMN -->
    <td valign="top" width="160">
    <!-- COLUMN GROUP TABLE -->
    <table width="160" border="0" cellpadding="2" cellspacing="0">
    <tr><td valign="top">
    <!-- ICON LINK BOX -->
    <table width="160" class="box_article" align="center" cellpadding="2">
    <tr><td valign="top">
    
    <!-- noprint -->
    
    <a href="/March 2006/pdf/articletitle.pdf"><img src="/images/box_icon_pdf2.gif" alt="Download a printable version of this article" width="125" height="18" border="0" align="absmiddle"></a><br>
    <a href="/related.asp"><img src="/images/box_icon_related2.gif" alt="Read a related story" width="125" height="18" border="0" align="absmiddle"></a><br>
    <a href="/email_article.asp"><img src="/images/box_icon_email2.gif" alt="Email this article to a friend" width="125" height="18" border="0" align="absmiddle"></a><br>
    <a href="/contact_form_steve.asp"><img src="/images/box_icon_letter2.gif" alt="Submit a letter to the Editor" width="125" height="18" border="0" align="absmiddle"></a><br>
    
    <!-- /noprint -->
    
    </td></tr></table>
    <!-- ICON LINK BOX END -->
    </td></tr>
    <!-- VERTICAL ICON LIST FOR ISSUE-->
    <tr><td valign="top">
    
    <!-- noprint -->
    
    <!--#include file ="articles_nav_march06.inc"-->
    
    <!-- /noprint -->
    
    </td></tr>
    <!-- END OF VERTICAL ICON LIST FOR ISSUE-->
    <!-- ADVERTISEMENT -->
    <tr><td valign="top">
    <table align="right"><tr><td>
    
    <!-- noprint -->
    
    <p align="center"><img src="/images/advertisement.gif"><br>
    <!--#include virtual ="/includes/article_ad.inc"-->
    </p>
    
    <!-- /noprint -->
    
    </td></tr>
    </table>
    </td></tr>
    <!-- ADVERTISEMENT END -->
    </table>
    <!-- COLUMN GROUP TABLE END -->
    </td>
    <!-- THIRD COLUMN END -->
    </tr>
    <!-- ROW END -->
    <!-- FOOTER -->
    <tr>
    <td colspan="5" valign="bottom">
    
    <!-- noprint -->
    
    <!--#include virtual ="/includes/footer.inc"-->
    
    <!-- /noprint -->
    
    </td>
    </tr>
    <!-- FOOTER END -->
    <!-- BLACK BOTTOM BANNER -->
    <tr>
    <td bgcolor="#000000" height="10" colspan="5" valign="bottom">&nbsp;</td>
    </tr>
    <!-- BLACK BOTTOM BANNER END -->
    </table>
    </td></tr>
    </table>
    </BODY>
    </HTML>
    Code:
    <%
    Dim page, text, filesys
    page = request.querystring("page")
    
        Sub ReplaceTxt(what,door)
       
        Dim regularExpressionObject
        Set RegularExpressionObject = New RegExp
        
        With RegularExpressionObject
        .Pattern = what
        .IgnoreCase = True
        .Global = True
        End With
        
        text = RegularExpressionObject.Replace(text,door)
        Set RegularExpressionObject = nothing
        End Sub
        
        'opening the page
        Set FileSys = server.createobject("scripting.FileSystemObject")
        text = filesys.openTextfile(server.mappath(page)).readall
        call replacetxt("<!-- noprint -->","<!--")
        call replacetxt("<!-- /noprint -->"," -->")
    	
        'writing the text-only version
        response.write "<font size='2' face='arial'><b>Printer Friendly Version of <i><a href='javascript:history.go(-1)'>"&page&"</a></i></b></font><br><hr noshade color='#000000' size='1'>"
        response.write text
        response.write "<p align='center'><font size='1' face='verdana'>test notice</font></p>"
    %>

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Why don't you just use stylesheet commands to determine what parts of the page to display on the screen and what parts to print so that the complex screen version is also the print friendly version. That is a part of what stylesheets are for.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •