<!DOCTYPE html> <script> setTimeout(function(){ alert(document.body); document.open(); alert(document.body); document.write('<p>Тест</p>'); alert(document.body); }, 100); </script> |
danik.js,
ещё раз спасибо ... но вставить картинку в стиль боди я не смог, думал вы мне поможите. |
<!DOCTYPE html> <script> setTimeout(function(){ document.open(); document.write('<p>Тест</p>'); document.close(); document.body.style.background = 'url(http://f2.foto.rambler.ru/preview/r/500x375/4692f001-918f-efa8-c60f-d37d57ef671d/ыв.jpg)'; }, 100); </script> |
danik.js,
ок ))) код ниже у меня несрабатывал, сейчас нормально.чего нехватало так и непонял. <!DOCTYPE HTML> <html> <head> <title></title> </head> <body> <div id="vwvwprint">555555777</div> <script> function f() { var s = document.getElementById("vwvwprint").innerHTML; var w2 = window.open("","","width=350, height=350"); w2.document.open(); w2.document.write(s); w2.document.close() w2.document.body.style.background='url("http://f2.foto.rambler.ru/preview/r/500x375/4692f001-918f-efa8-c60f-d37d57ef671d/ыв.jpg") no-repeat left top' } f(); </script> </body> </html> |
не работаеть...окно не открываеться когда вставляю
w2.document.getElementsByTagName("body")[0].style.background='url("http://f2.foto.rambler.ru/preview/r/500x375/4692f001-918f-efa8-c60f-d37d57ef671d/ыв.jpg") no-repeat left top'; |
Цитата:
Цитата:
|
Цитата:
Цитата:
|
Полный код дай.
|
function f() { var s = document.getElementById("vwvwprint").innerHTML; var w2 = window.open("width=350, height=350"); w2.document.open(); w2.document.write(s); var link = document.createElement("link"); link.rel = "stylesheet"; link.href = "style.css"; var head = w2.document.getElementsByTagName("head")[0]; head.appendChild(link); w2.document.close() } <img src="print.p.jpg" onclick="f()"> |
Что-то я в упор не вижу w2.document.body.style.background
|
Часовой пояс GMT +3, время: 13:42. |