• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Problem in code

Hi all,

I had spent lots of time in print issue in the below code.
document.write() will not allow to print the images while going to print the screen.

Here is my code... I am using style sheet....

<html><head></head><body>
<style type="text/css">
SPAN.red {background-color: #FF6600}
SPAN.green {background-color: #6666FF}
.green { background-image: url('c:/green.jpg'); width:50px }
.red   { background-image: url('c:/blue.jpg');   width:50px }
.yellow { background-color:yellow;   width:50px }
.noyellow { background-color:;   width:50px }
.free { background-color:#660000;   width:50px }
.n { width:50px }
.suresh{  }
.green1 { background-image: url('c:/green.jpg'); width:10px }
.red1   {background-image: url('c:/blue.jpg');   width:10px }
.yellow1 { background-color:#660000;   width:10px }

</style>
<div align="center"><table><tr><td><b>Plot</b></td></tr></table></div><TABLE>
<TBODY>
<TR>
<TD>Title Comes Here.....</TD>
<TD>&nbsp;&nbsp;&nbsp;</TD>
<TD class=green1></TD>
<TD>CLR-1&nbsp;&nbsp;&nbsp;</TD>
<TD class=red1></TD>
<TD>CLR-2&nbsp;&nbsp;&nbsp;</TD>
<TD><IMG height=20 src="C:/open.jpg" width=10 border=0></TD>
<TD>CLR-3</TD></TR></TBODY></TABLE>
<TABLE class=timetable cellSpacing=0  border="0">
<TBODY>
<TR align=middle>
<TD class=wide><B><FONT size=-2>One</FONT></B>&nbsp;&nbsp;</TD>
<TD class=wide><B><FONT size=-2>Two</FONT></B>&nbsp;</TD>
<TD class=wide><B><FONT size=-2>Three</FONT></B></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>1</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>2</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>3</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>4</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>5</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>6</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>7</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>8</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>9</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>10</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>11</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>12</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>13</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>14</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>15</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>16</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>17</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>18</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>19</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>20</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>21</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>22</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>23</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>24</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>1</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>2</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>3</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>4</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>5</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>6</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>7</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>8</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>9</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>10</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>11</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>12</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>13</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>14</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>15</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>16</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>17</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>18</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>19</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>20</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>21</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>22</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>23</TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n></TD>
<TD class=n>24</TD></TR>
<TR>
<TD><FONT size=-1>Num1</FONT>&nbsp;</TD>
<TD align=middle><FONT size=-1>Data1</FONT>&nbsp;</TD>
<TD align=middle><A href="#"><IMG height=13 src="/1.gif" width=13 border=0></A></TD>
<TD class=n colSpan=5></TD>
<TD class=green title=Cerutti colSpan=12 MT - 10></TD>
<TD class=red title=Cerutti colSpan=95 MT - 10></TD>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD><FONT size=-1>Num2</FONT>&nbsp;</TD>
<TD align=middle><FONT size=-1>&nbsp;,,</FONT>&nbsp;</TD>
<TD align=middle><A href="#"><IMG height=13 src="1.gif" width=13 border=0></A></TD>
<TD class=n colSpan=44></TD>
<TD class=noyellow colSpan=-67.24></TD>
<TD class=green title=Cerutti colSpan=28 MT - 10></TD>
<TD class=red title=Cerutti colSpan=122 MT - 10></TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD class=red title=Cerutti colSpan=192 MT - 10></TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD class=red title=Cerutti colSpan=92 MT - 10></TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
</TBODY></TABLE></body></html>

I have image files called green.jpg and blue.jpg, this image will display in the page, but if I take print out , the page doesn't contain images.
Can anyone help me to solve this?

Thanks
0
r_kar
Asked:
r_kar
  • 2
  • 2
2 Solutions
 
mmarksburyCommented:
By default the browser does not print background images.  It is a browser setting that the HTML cannot control.
0
 
r_karAuthor Commented:
hi,
so how can I print that? Is there any method to solve that?
0
 
mmarksburyCommented:
A few options:

1. Instead of using background images with text on top, use images that have the text as part of them.

2. (this one might work) Place a div with text on-top of an image.

It's one of those things that HTML wasnt designed for so you have to make a work around.
0
 
r_karAuthor Commented:
hi,
my intension is to fill the colors inside TD. While printing the doc, the color is not printing.
So I got a solution from other site , if I use gif in style sheet I can get the required solution.
My green.jpg and blue .jpg files 10*10 color images...

So how can I proceed that?

thanks
0
 
JezcentralCommented:
Put this line in the head:

<link href="myCssSheet.css" rel="stylesheet" type="text/css" media="print">

Then write a new stylesheet called myCssSheet.css, without the colors you don't want, and with the image you do want. The media="print" means that the stylesheet the printer uses will be the this one, and not the one you already have at the top of your HTML page.

Jezcentral.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now