Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #9757

Re: Viewing the Generated Page

Newsgroups comp.lang.javascript
Subject Re: Viewing the Generated Page
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <05vkf7t9vfcps7dcil66bnqtdk33ua2ngv@4ax.com>
Message-ID <Xns9FCA6309F9FA6eejj99@194.109.133.133> (permalink)
Date 2011-12-29 08:44 +0000

Show all headers | View raw


Gene Wirchenko wrote on 28 dec 2011 in comp.lang.javascript:

> How do I view the generated page?  I do not mean the source, but
> the result of the source.  I could -- read as "quite probably do" --
> have errors in my JavaScript, and it would be easier if I could see
> what page has resulted from my code.
> 

Using Chrome and Shortcut Manager, 
I use the below under Ctrl-A10,
showing the effective/dynamic html of a selected range,
first in a confirm() box, 
and if confirmed at the page bottom for copying:

===============================================

function getSelectedHTML(){
  var rng=null,html="";
  rng=window.getSelection();
  if (rng.rangeCount > 0 && window.XMLSerializer){
    rng=rng.getRangeAt(0);
    html=new XMLSerializer().serializeToString(rng.cloneContents());
  };
  return html;
};

var x = getSelectedHTML()

if (confirm( x +'\n\n[Send a copy to the bottom of this page?]') ){
  var tempNode = document.createElement('div');
  tempNode.style.border='black 2px solid';
  tempNode.style.backgroundColor='#eee';
  tempNode.style.width='800px';
  tempNode.style.padding='20px';
  tempNode.style.margin='20px 20px 200px 100px ';
  tempNode.innerHTML = x.replace(/</g,'<br>&lt;');
  document.body.appendChild(tempNode);
};

==============================================



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Viewing the Generated Page Gene Wirchenko <genew@ocis.net> - 2011-12-27 18:19 -0800
  Re: Viewing the Generated Page Gene Wirchenko <genew@ocis.net> - 2011-12-27 18:22 -0800
    Re: Viewing the Generated Page Mentifex <mentifex@myuw.net> - 2011-12-27 19:06 -0800
  Re: Viewing the Generated Page "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-29 08:44 +0000
  Re: Viewing the Generated Page Dr J R Stockton <reply1152@merlyn.demon.co.uk> - 2011-12-29 19:40 +0000

csiph-web