Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   как сделать чтобы в popup окне показывалось картинка? (https://javascript.ru/forum/misc/36328-kak-sdelat-chtoby-v-popup-okne-pokazyvalos-kartinka.html)

danik.js 13.03.2013 15:33

<!DOCTYPE html>
<script>
setTimeout(function(){
    alert(document.body);
    document.open();
    alert(document.body);
    document.write('<p>Тест</p>');
    alert(document.body);
}, 100);
</script>

рони 13.03.2013 15:37

danik.js,
ещё раз спасибо ... но вставить картинку в стиль боди я не смог, думал вы мне поможите.

danik.js 13.03.2013 16:39

<!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>

рони 13.03.2013 17:05

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>

sarik 14.03.2013 10:08

не работаеть...окно не открываеться когда вставляю
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';

ksa 14.03.2013 10:30

Цитата:

Сообщение от sarik
окно не открываеться когда вставляю

Пробуй как показали выше

Цитата:

Сообщение от рони
w2.document.body.style.background='url("http://f2.foto.rambler.ru/preview/r/500x375/4692f001-918f-efa8-c60f-d37d57ef671d/ыв.jpg") no-repeat left top'


sarik 14.03.2013 10:50

Цитата:

Сообщение от ksa
Пробуй как показали выше

Попробовал но не работаеть.Окно не открываеться после того как вставляю данный скрипт
Цитата:

Сообщение от ksa
Сообщение от рони






w2.document.body.style.background='url("http://f2.foto.rambler.ru/preview/r/500x375/4692f001-918f-efa8-c60f-d37d57ef671d/ыв.jpg") no-repeat left top'


danik.js 14.03.2013 15:54

Полный код дай.

sarik 14.03.2013 16:28

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()">

danik.js 14.03.2013 18:13

Что-то я в упор не вижу w2.document.body.style.background


Часовой пояс GMT +3, время: 13:42.