Viewing the Generated Page

G

Gene Wirchenko

Dear JavaScripters:

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.

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

Dear JavaScripters:

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.

I am using IE 9.

Sincerely,

Gene Wirchenko
 
M

Mentifex

    How do I view the generated page? [...]
     I am using IE 9.

You could do it the same way I do coding

http://wwww.scn.org/~mentifex/Dushka.html

as a Russian-thinking artificial AI Mind.
Namely, on your computer you keep Internet
Explorer open in one window to hold the
"generated page", and you keep the JavaScript
source code open in another window for editing.

MSIE only seems to refresh the "generated page"
properly when you have "saved" the source code
with at least one change made to it. Then you
click on Refresh at the top of the browser,
and it renders the generated page for you.

Hope this helps.

Mentifex (Arthur)
 
E

Evertjan.

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);
};

==============================================
 
D

Dr J R Stockton

In comp.lang.javascript message <05vkf7t9vfcps7dcil66bnqtdk33ua2ngv@4ax.
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.


Ocularly.

You should say what sort of system you are using, in case it matters.

Remember that your operating system is almost certainly not called
"Window".

I just edit the source file (in PFE, at top left) and have a browser
(generally Firefox, not maximised, top right) open. An incantation such
as file:///C:/wsh/seek/seakfyle.htm#elsewhere can be entered in the
address bar. All my browsers can read that, though Opera replaces it
with file://localhost/C:/HOMEPAGE/FREQUENT.HTM which Firefox can
read ...

You can also go via "My Computer", find the desired HTM or HTML file,
and double-click on it.

Then I cycle through Edit, Save, refresh browser, as nauseam.

Opera allows the reader to edit the "view Source" of the page being
viewed, and view or save it. Using that, you ___could__ edit in Opera,
check-view in Opera, save, and real-test in IE.

For some testing, it is better to use the page from your real ultimate
public web server. Generally, AIUI, instead of that, one can install a
private server on one's local computer.

But you should not, I think, think that there is _necessarily_ within
the displaying machine an HTML version of what is seen. If you code

<p>para1</p> <p>para1</p>
<p ID=GW></p> it looks like <p>para2</p>
<p>para3</p> <p>para3</p>

after executing documemt.getElementById("GW").innerHTML = "para2"

but the displayed object is a tree structure of DOM elements rooted in
the document object (which is apparently parentless). Play with
<http://www.merlyn.demon.co.uk/js-props.htm#F> and, possibly aided by
the instructions, you will see that.

You may find that setting a textarea's value to document.body.innerHTML
shows what you want to see.

For "scratchpad" tests, I use a local copy of
<http://www.merlyn.demon.co.uk/js-quick.htm>.

You can write the results of your script to, say, a textarea as well as
into, say, the target <DIV>.

But it's not at all clear to me where your difficulty arises.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top