6.6.06

JS Generated print header content MSIE



function genCon(){
var obl=document.getElementById('obal')
var h1=obl.getElementsByTagName('h1')
for(var i=0;i<h1.length;i++){
var gen=document.createElement('pre');//impossible to create <br> with \n in span, that is why <pre>
var textik=new Array('Pavlova 123/4 160 00 Praha 6 - Dejvice','tel:123 456 789','info@neco.cz','www.neco.cz');
gen.appendChild(document.createTextNode(textik.join("\n")));
gen.style.font='normal normal bold 12pt 2px \'Trebuchet MS\', \'Geneva CE\', lucida, sans-serif';
gen.style.display='none';
gen.className='iegen';
h1[i].appendChild(gen);
}}
if(document.childNodes&&document.uniqueID){window.onload=genCon;}



Generated Generated print header content Gecko and Opera: CSS


body{background:#fff !important;font-size:12pt;}/*every Opera version has different bug, opera 9 do not remove background in print style*/
#navi,.obr,#patka{display:none;}
#obsah,h1{width:auto;margin:0 5%;padding:0;border:0;float:none !important;color:black;background:transparent none;}
div#obsah{margin-left:10%;padding-top:1em;border-top:1px solid #000;}
a:link, a:visited{color:#444;background:transparent;font-weight:bold;text-decoration:underline;}
#obsah a:link:after, #obsah a:visited:after{content:" (" attr(href) ") ";font-size:90%;}
h1:after{content:'Pavlova 123/4 160 00 Praha 6 - Dejvice \00000a tel:123 456 789 \00000a info@neco.cz\00000a www.neco.cz' !important;display:block;white-space:pre;font-size:12pt;}
:before,:after{white-space:pre-line;}
option{display:block;}
h1 a{text-decoration:none !important;border:none;font-size:18pt;color:#000;}
.iegen{display:block !important;}


Result:


This will add to print header just under <h1> this:



Pavlova 123/4 160 00 Praha 6 - Dejvice
tel:123 456 789
info@neco.cz
www.neco.cz


Example:


Test what is this good for, on bit styled working example. To view it in action just choose print preview in your browser.


Tested in Firefox 0.7+, IE 5+, Opera 7.23+


Use script and style as you want, don't steel design.

0 Comments:

Okomentovat

<< Home