Hello!

I have a problem regarding writing to head tag. Here is the situation: I have
a page with link tag that points to .css which has screen media. Now, I put a
button print to the same page which opens the same page in a new window and
appends certain querystring to the URL eg. print=yes. In all of the pages there
is a javascript script that *should* write another link tag (based on
querysting) pointing to .css with media print so the user could see print
preview. Now I still learning javascript and I'm appending the code. Any help
appreciated. Thanks.

<script language="JavaScript" type="text/JavaScript">
var title;
var query;
title = document.URL;
query = title.indexOf('?');
if (query != -1) {
if (title.substr(query) == 'print=yes') {
document.write('<LINK HREF="/css/print.css" REL="stylesheet" TYPE="text/css"
MEDIA="print">');
}
}
</script>