Print from a <div>

I am a designer new to javascript. I would like to open a specifiv div (with a specific id) in a new window. On this window I would like to attach a specific print stylesheet (css) and have a print button on the screen to print the screen. As I am new, I need detailed instructions and examples. I appreciate ay assistance.

Thanks

Thais sounds good. How do i grab the html inside a <div> and place it in the new screen?

huh?
here’s an example:
page1.html

<p>some text… Want to <a href=“javascript:window.open(‘/page2.html’, ‘Detail’, ‘width=300,height=150,status=yes,location=no’);”>read more</a>?

pag2.html
<html>…
<div>
that div yuo want
</div

This works, just change the build page in the new window to suit your needs.

<html>

<head>
<script type=“text/Javascript”>
<!–
var newWindow=null; // global
// open window and insert content
function buildPage()
{ // check to see if it already exists
if(!newWindow || newWindow.closed)
{ newWindow=window.open(“”,“xx”,“status=1,height=300,width=300”);
// delay writing to allow window to be created
setTimeout(“write2Window()”,100);
}
else
{ newWindow.focus();
}
}
// ---------------
function write2Window()
{ var build='<html>
<head>
<title>My Window</title>
‘;
build+=’<style type=“text/css”>
#win1 {position:absolute; top:100px; left:100px; text-align:left; }
<\/style>
<\/head>
‘;
build+=’<body>
<div id=“win1”>
<p>This is your content<\/p><\/div>
<\/body>
<\/html>
';
newWindow.document.write(build);
newWindow.document.close();
}

//–>
</script>
<style type=“text/css”>
<!–
body { font-famil:arial; font-size:13px; font-weight:bold; color:#000; }
#firstPage { position:absolute; top:100px; left:100px; text-align:left; cursor: pointer; }
–>
</style>
</head>

<body>

<div id=“firstPage” onclick=“buildPage()”>
<p class=“a”>Open new window</div>

</body>

</html>

Well, read this… since you have to give a source for the window, code it how you see fit.