473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Reprocess page after document.write

I am working with a special tool which pre-processes the page. Using
document.write, I am composing the page while it is loading, so I need
to force a reprocess of the page AFTER the page loads.

Is there some way to do that? That is, I want the browser to
essentially act as if the composed page was the original page.
Here is a brief version of the page construction technique:

<!DOCTYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 Strict//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><SCRIPT
LANGUAGE="JavaScript" TYPE="text/javascript">
nxitm=" ";iam=" ";setstart=1;comx=0;holdshf=false;zmaxv=0;
function oneitem(curp,chkVls,chkNms) {
alert('curp:'+curp+',name:'+chkNms[curp+11]+",val:"+chkVls[curp+11]);
var cma=0;var cmb=0;var retstr=' ';
if (chkVls[curp+11] == 1) {
if (chkVls[curp] == 1) {cma=1;}
if (chkVls[curp+5] == 1) {cmb=1;}
retstr='{sq'+'l} INSERT into shal';
retstr=retstr='tpkd.cmfform(pw=haltpwd) {\s'+'ql}';
}
return (retstr);
}
// get document.location, decode, assign
var chkStr = document.location.href.split('?')[1].split('&');
var chkNms = document.location.href.split('?')[1].split('&');
var chkVls = document.location.href.split('?')[1].split('&');
for(var x=0; x<chkStr.length; x++)
{
var tmp = chkStr[x].split('=');
chkNms[x]=unescape(tmp[0]);
chkVls[x]=unescape(tmp[1]);
eval(unescape(tmp[0]) + '="' + unescape(tmp[1]) + '"');
}
var restpage='<!DOCTYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 ';
restpage=restpage+'Strict//EN">';
restpage=restpage+'<HTML><HEAD><TITLE>Concomitant ';
restpage=restpage+'Medications Form</TITLE>';
restpage=restpage+'<SCRIPT LANGUAGE="JavaScript"';
restpage=restpage+' TYPE="text/javascript"';
restpage=restpage+' SRC="http://localhost/haltpkd/java/mainjava.js">';
restpage=restpage+'</SC'+'RIPT>';
restpage=restpage+'<L'+'INK REL=STYLESHEET type="text/css"';
restpage=restpage+' HREF="http://localhost/haltpkd/css/maincss.css">';
restpage=restpage+'</L'+'INK>';
restpage=restpage+'</H'+'EAD>';
restpage=restpage+'<BO'+'DY>';
restpage=restpage+'<FO'+'RM NAME="cmfform" METHOD="POST">';
restpage=restpage+'{up'+'date server="rook:haltpkd" sapw="milo99ha"}';
restpage=restpage+'{lib'+'rary sqlname="shaltpkd"';
restpage=restpage+'path="/data/pkdtn/linux"}';
restpage=restpage+'<INPUT TYPE="HIDDEN" NAME="_haltid"';
restpage=restpage+' VALUE="'+chkVls[0]+'">';
for (curp=13;curp<chkVls.length-12;curp=curp+14) {
restpage=restpage+oneitem(curp,chkVls,chkNms);
}
restpage=restpage+'{/upd'+'ate}';
restpage=restpage+'<SCRIPT LANGUAGE="JavaScript"';
restpage=restpage+' TYPE="text/javascript">';
restpage=restpage+'document.cmfform.action=actstr+ "getv.hsql";';
restpage=restpage+'document.cmfform.submit();';
restpage=restpage+'</SC'+'RIPT> </F'+'ORM> </B'+'ODY> </H'+'TML>';
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="cmfform" METHOD="POST">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
document.write(restpage);
</SCRIPT>
</BODY> </HTML>
Jul 23 '05 #1
3 3572
Paul Thompson wrote:

I am working with a special tool which pre-processes the page. Using
document.write, I am composing the page while it is loading, so I need
to force a reprocess of the page AFTER the page loads.

Is there some way to do that? That is, I want the browser to
essentially act as if the composed page was the original page.


Hi Paul,

A suggestions that comes into mind (without any knowledge of all the
difficulties your are in):
Why not buffer the complete output in a var, and when done, write that?

Regards,
Erwin Moller

Jul 23 '05 #2
In article <ct**********@newsreader.wustl.edu>,
Paul Thompson <pa**@wubios.wustl.edu> wrote:
I am working with a special tool which pre-processes the page. Using
document.write, I am composing the page while it is loading, so I need
to force a reprocess of the page AFTER the page loads.

Is there some way to do that? That is, I want the browser to
essentially act as if the composed page was the original page.


What is failing?

You only need to escape the </script> tag. An easier way to do this is:
<\/script>. When a browser sees, <script> it scans for the </script>
tags. Some browser ignore things in quotes in when doing this scan.
Hence the need for escaping.
See RobG's explains how to construct a string containing html. Grooge
won't let me point to one post but only a thred. Here is the thread:

http://groups-beta.google.com/group/...owse_thread/th
read/f8d72fff92b97c76/ddd4888398a775c1?q=robg+Cant+correctly+load+.js&_d o
ne=%2Fgroup%2Fcomp.lang.javascript%2Fsearch%3Fgrou p%3Dcomp.lang.javascrip
t%26q%3Drobg+Cant+correctly+load+.js%26qt_g%3D1%26 searchnow%3DSearch+this
+group%26&_doneTitle=Back+to+Search&&d#ddd4888398a 775c1

RobG Oct 14 2004, 8:17 pm
Subject: Re: Cant correctly load .js files when creating page
dynamically in IE

Here is RobG's code. Hope he doesn't mind.

<html>
<head>
<title>New Page</title>
<script type="text/javascript">
function loadWindow() {
var VE3DWindow = window.open('',
'VE3DWin','resizable=1,width=400,height=400')
var a = [
'<!DOCTYPE HTML PUBLIC ',
'"-//W3C//DTD HTML 4.01 Transitional//EN"',
'"http://www.w3.org/TR/html4/loose.dtd">',
'<html>',
'<head>',
'<meta http-equiv="Content-Type" ',
'content="text/html; charset=iso-8859-1">',
'<title>Untitled Document</title>',
'<script type="text/JavaScript" src="xx.js"></scr',
'ipt>',
'<script type="text/JavaScript">alert(location);</scr',
'ipt>',
'</head>',
'<body>',
'<p>Here is a page</p><p>here is some text</p>',
'<p>and some more text</p>',
'<form action=""><input type="button" ',
'value="Open Window"',
'onclick="xx();"></form>',
'</body>',
'</html>',
];
VE3DWindow.document.write(a.join(""))
VE3DWindow.document.close()
}

</script>
</head>
<body>
<form action="">
<input type="button" value="Open Window"
onclick="loadWindow();">
</form>
</body>
</html>

file xx.js:

function xx() {
alert('hi');
}
Robert
Jul 23 '05 #3
In article <ct**********@newsreader.wustl.edu>,
Paul Thompson <pa**@wubios.wustl.edu> wrote:
I am working with a special tool which pre-processes the page. Using
document.write, I am composing the page while it is loading, so I need
to force a reprocess of the page AFTER the page loads.


There are a lot of bugs in the posted code. Try running the code in
Firefox and look at the javascript console. I made some changes but
after the first 7 errors I have stopped. The first error was a missing
</script> tag on the first script line.

the line:
restpage=restpage+'Strict//EN">';
can be written as:
restpage += 'Strict//EN">';

<!DOCTYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 Strict//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"></SCRIPT>
<script LANGUAGE="JavaScript" TYPE="text/javascript">
nxitm=" ";iam=" ";setstart=1;comx=0;holdshf=false;zmaxv=0;
function oneitem(curp,chkVls,chkNms) {
alert('curp:'+curp+',name:'+chkNms[curp+11]+",val:"+chkVls[curp+11]);
var cma=0;var cmb=0;var retstr=' ';
if (chkVls[curp+11] == 1) {
if (chkVls[curp] == 1) {cma=1;}
if (chkVls[curp+5] == 1) {cmb=1;}
retstr='{sq'+'l} INSERT into shal';
retstr=retstr='tpkd.cmfform(pw=haltpwd) {\s'+'ql}';
}
return (retstr);
}
// get document.location, decode, assign
/*
var chkStr = document.location.href.split('?')[1].split('&');
var chkNms = document.location.href.split('?')[1].split('&');
var chkVls = document.location.href.split('?')[1].split('&');
for(var x=0; x<chkStr.length; x++)
{
var tmp = chkStr[x].split('=');
chkNms[x]=unescape(tmp[0]);
chkVls[x]=unescape(tmp[1]);
eval(unescape(tmp[0]) + '="' + unescape(tmp[1]) + '"');
}
actstr = " ";
var restpage='<!DOCTYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 ';
restpage=restpage+'Strict//EN">';
restpage=restpage+'<HTML><HEAD><TITLE>Concomitant ';
restpage=restpage+'Medications Form</TITLE>';
restpage=restpage+'<SCRIPT LANGUAGE="JavaScript"';
restpage=restpage+' TYPE="text/javascript"';
restpage=restpage+' SRC="http://localhost/haltpkd/java/mainjava.js">';
restpage=restpage+'</SC'+'RIPT>';
restpage=restpage+'<L'+'INK REL=STYLESHEET type="text/css"';
restpage=restpage+' HREF="http://localhost/haltpkd/css/maincss.css">';
restpage=restpage+'</L'+'INK>';
restpage=restpage+'</H'+'EAD>';
restpage=restpage+'<BO'+'DY>';
restpage=restpage+'<FO'+'RM NAME="cmfform" METHOD="POST">';
restpage=restpage+'{up'+'date server="rook:haltpkd" sapw="milo99ha"}';
restpage=restpage+'{lib'+'rary sqlname="shaltpkd"';
restpage=restpage+'path="/data/pkdtn/linux"}';
restpage=restpage+'<INPUT TYPE="HIDDEN" NAME="_haltid"';
restpage=restpage+' VALUE="'+chkVls[0]+'">';
for (curp=13;curp<chkVls.length-12;curp=curp+14) {
restpage=restpage+oneitem(curp,chkVls,chkNms);
}
restpage=restpage+'{/upd'+'ate}';
restpage=restpage+'<SCRIPT LANGUAGE="JavaScript"';
restpage=restpage+' TYPE="text/javascript">';
restpage=restpage+'document.cmfform.action=actstr+ "getv.hsql";';
restpage=restpage+'document.cmfform.submit();';
restpage=restpage+'</SC'+'RIPT> </F'+'ORM> </B'+'ODY> </H'+'TML>';
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="cmfform" METHOD="POST">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
document.write(restpage);
</SCRIPT>
</BODY> </HTML>
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hitit | last post by:
I found the script below in internet and I want it to create a page with links for each date changing according to date. For example: For August 10, the link in calendar page should point to:...
4
by: Jake Lewis | last post by:
I have an HTML page that loads fine including the .js file <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script...
2
by: Keyser | last post by:
On most my pages, I use Javascript to play a sound. It works fine in Netscape 4.7, Netscape 7.2, Firefox 1.0, IE5 and IE6 using Windows98 as the operating system. However, using WindowsXP as the...
3
by: pjglick | last post by:
I am sorry if this sounds hokey but I am a newbie to ASP. I have a VBScript running in an ASP page. The script makes a connection to Oracle via and ADODB connection. When my clients connect...
7
by: sunil philip | last post by:
How do i identify the page that fired a method? e.g. page1.html ----------- <Head> <script> document.write(myfun()); </script>
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
12
by: joe | last post by:
I have a Javascript page which needs to be dynamically changed depending on user input. The whole page is written on document.write() output. I am still new to Javascript and run into problems...
4
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole...
8
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.