Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 print javascript?

Author  Topic 

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-11 : 04:34:43
Hi All ,

I have a HTML page with TextArea ,In the TextArea i have some comments now i need to print only the Comments in the TextArea using javascript ,i need to eliminate the print and cancel button and print only the Comments in the TextArea...

Any solution ????

Deepak N

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-11 : 05:18:54
open a new page that contains only comments and print that.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-12 : 02:38:03
spirit,

without opening new page ...
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-12 : 04:40:02
where are those print and close buttons located?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-13 : 02:03:55
in the same page
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-13 : 03:52:57
well then you'll have to make a function that takes the text from the text areas put it all in one string
and pass that to the print function.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-13 : 05:05:28
i think we have doument.print Javascript how we can send the string alone to the javascript function????
Go to Top of Page

cas_o
Posting Yak Master

154 Posts

Posted - 2007-07-13 : 05:39:20
Use css. Add this in the <head></head> section:

<style type="text/css">
@media print {
.noprint { display: none; }
}
</style>

Add this to your button's attributes:

class="noprint"

;-]... Quack Waddle
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-13 : 06:03:12
hey that's pretty slick.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-20 : 08:03:44
Below is my script i just want to print only table content...
please guide me with some solution.....
<HTML>
<TITLE></TITLE>
<Head>
<style type="text/css">
<!--
@media print{
.noprn{
display:none;
visibility:hidden;
}
.prn{
left:0px;
top:0px;
display:block;
visibility:visible;
}
}
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
function printImg(who){
document.getElementById(who).className='prn';
window.print()
}
//-->
</script>
</Head>
<BODY>
<FORM >

<TABLE id="mycont" border=1><TR><TD> Alerts as of 13/07/2007
Test
</TD></TR>
</TABLE>

<Input type=Button Name="print" value="Print" class="noprint" onclick="printImg('mycont');">
<input type=Button Name="Cancel" value="Cancel" >
</form>
</BODY>
</HTML>
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2007-07-20 : 11:31:20
I dont see a textarea input type in the code. Are you just trying to print only the contents of the table?

Thanks
Karunakaran
Go to Top of Page

DeepakNewton
Starting Member

39 Posts

Posted - 2007-07-23 : 01:31:48
Karuna,
Instead of textArea i have used Table
Go to Top of Page
   

- Advertisement -