473,747 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript" TYPE="text/javascript"><SC RIPT
LANGUAGE="JavaS cript" TYPE="text/javascript">
nxitm=" ";iam=" ";setstart=1;co mx=0;holdshf=fa lse;zmaxv=0;
function oneitem(curp,ch kVls,chkNms) {
alert('curp:'+c urp+',name:'+ch kNms[curp+11]+",val:"+chk Vls[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.locati on, decode, assign
var chkStr = document.locati on.href.split(' ?')[1].split('&');
var chkNms = document.locati on.href.split(' ?')[1].split('&');
var chkVls = document.locati on.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(t mp[0]) + '="' + unescape(tmp[1]) + '"');
}
var restpage='<!DOC TYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 ';
restpage=restpa ge+'Strict//EN">';
restpage=restpa ge+'<HTML><HEAD ><TITLE>Concomi tant ';
restpage=restpa ge+'Medications Form</TITLE>';
restpage=restpa ge+'<SCRIPT LANGUAGE="JavaS cript"';
restpage=restpa ge+' TYPE="text/javascript"';
restpage=restpa ge+' SRC="http://localhost/haltpkd/java/mainjava.js">';
restpage=restpa ge+'</SC'+'RIPT>';
restpage=restpa ge+'<L'+'INK REL=STYLESHEET type="text/css"';
restpage=restpa ge+' HREF="http://localhost/haltpkd/css/maincss.css">';
restpage=restpa ge+'</L'+'INK>';
restpage=restpa ge+'</H'+'EAD>';
restpage=restpa ge+'<BO'+'DY>';
restpage=restpa ge+'<FO'+'RM NAME="cmfform" METHOD="POST">' ;
restpage=restpa ge+'{up'+'date server="rook:ha ltpkd" sapw="milo99ha" }';
restpage=restpa ge+'{lib'+'rary sqlname="shaltp kd"';
restpage=restpa ge+'path="/data/pkdtn/linux"}';
restpage=restpa ge+'<INPUT TYPE="HIDDEN" NAME="_haltid"' ;
restpage=restpa ge+' VALUE="'+chkVls[0]+'">';
for (curp=13;curp<c hkVls.length-12;curp=curp+14 ) {
restpage=restpa ge+oneitem(curp ,chkVls,chkNms) ;
}
restpage=restpa ge+'{/upd'+'ate}';
restpage=restpa ge+'<SCRIPT LANGUAGE="JavaS cript"';
restpage=restpa ge+' TYPE="text/javascript">';
restpage=restpa ge+'document.cm fform.action=ac tstr+"getv.hsql ";';
restpage=restpa ge+'document.cm fform.submit(); ';
restpage=restpa ge+'</SC'+'RIPT> </F'+'ORM> </B'+'ODY> </H'+'TML>';
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="cmfform" METHOD="POST">
<SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
document.write( restpage);
</SCRIPT>
</BODY> </HTML>
Jul 23 '05 #1
3 3600
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**********@n ewsreader.wustl .edu>,
Paul Thompson <pa**@wubios.wu stl.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/f8d72fff92b97c7 6/ddd4888398a775c 1?q=robg+Cant+c orrectly+load+. js&_do
ne=%2Fgroup%2Fc omp.lang.javasc ript%2Fsearch%3 Fgroup%3Dcomp.l ang.javascrip
t%26q%3Drobg+Ca nt+correctly+lo ad+.js%26qt_g%3 D1%26searchnow% 3DSearch+this
+group%26&_done Title=Back+to+S earch&&d#ddd488 8398a775c1

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','resi zable=1,width=4 00,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>Untitle d Document</title>',
'<script type="text/JavaScript" src="xx.js"></scr',
'ipt>',
'<script type="text/JavaScript">ale rt(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=""><inpu t type="button" ',
'value="Open Window"',
'onclick="xx(); "></form>',
'</body>',
'</html>',
];
VE3DWindow.docu ment.write(a.jo in(""))
VE3DWindow.docu ment.close()
}

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

file xx.js:

function xx() {
alert('hi');
}
Robert
Jul 23 '05 #3
In article <ct**********@n ewsreader.wustl .edu>,
Paul Thompson <pa**@wubios.wu stl.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=restpa ge+'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="JavaS cript" TYPE="text/javascript"></SCRIPT>
<script LANGUAGE="JavaS cript" TYPE="text/javascript">
nxitm=" ";iam=" ";setstart=1;co mx=0;holdshf=fa lse;zmaxv=0;
function oneitem(curp,ch kVls,chkNms) {
alert('curp:'+c urp+',name:'+ch kNms[curp+11]+",val:"+chk Vls[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.locati on, decode, assign
/*
var chkStr = document.locati on.href.split(' ?')[1].split('&');
var chkNms = document.locati on.href.split(' ?')[1].split('&');
var chkVls = document.locati on.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(t mp[0]) + '="' + unescape(tmp[1]) + '"');
}
actstr = " ";
var restpage='<!DOC TYPE HTML SYSTEM "-//W3C//DTD XHTML 1.0 ';
restpage=restpa ge+'Strict//EN">';
restpage=restpa ge+'<HTML><HEAD ><TITLE>Concomi tant ';
restpage=restpa ge+'Medications Form</TITLE>';
restpage=restpa ge+'<SCRIPT LANGUAGE="JavaS cript"';
restpage=restpa ge+' TYPE="text/javascript"';
restpage=restpa ge+' SRC="http://localhost/haltpkd/java/mainjava.js">';
restpage=restpa ge+'</SC'+'RIPT>';
restpage=restpa ge+'<L'+'INK REL=STYLESHEET type="text/css"';
restpage=restpa ge+' HREF="http://localhost/haltpkd/css/maincss.css">';
restpage=restpa ge+'</L'+'INK>';
restpage=restpa ge+'</H'+'EAD>';
restpage=restpa ge+'<BO'+'DY>';
restpage=restpa ge+'<FO'+'RM NAME="cmfform" METHOD="POST">' ;
restpage=restpa ge+'{up'+'date server="rook:ha ltpkd" sapw="milo99ha" }';
restpage=restpa ge+'{lib'+'rary sqlname="shaltp kd"';
restpage=restpa ge+'path="/data/pkdtn/linux"}';
restpage=restpa ge+'<INPUT TYPE="HIDDEN" NAME="_haltid"' ;
restpage=restpa ge+' VALUE="'+chkVls[0]+'">';
for (curp=13;curp<c hkVls.length-12;curp=curp+14 ) {
restpage=restpa ge+oneitem(curp ,chkVls,chkNms) ;
}
restpage=restpa ge+'{/upd'+'ate}';
restpage=restpa ge+'<SCRIPT LANGUAGE="JavaS cript"';
restpage=restpa ge+' TYPE="text/javascript">';
restpage=restpa ge+'document.cm fform.action=ac tstr+"getv.hsql ";';
restpage=restpa ge+'document.cm fform.submit(); ';
restpage=restpa ge+'</SC'+'RIPT> </F'+'ORM> </B'+'ODY> </H'+'TML>';
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="cmfform" METHOD="POST">
<SCRIPT LANGUAGE="JavaS cript" 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
1605
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: /cgi-bin/calendar_day.pl?userdir=calend&dept=boys&weekends=1&datestamp=20040 810 For August 11, the link in calendar page should point to: /cgi-bin/calendar_day.pl?userdir=calend&dept=boys&weekends=1&datestamp=20040 811
4
2663
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 language="JavaScript" type="text/JavaScript" src="ve3d.js" ></script> </head>
2
2186
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 operating system, the entire Netscape 7.2 browser and Firefox 1.0 browser shuts down when I try to use the Back button on these pages. Is there some setting in Windows XP that is causing this or is there something I can add to the Javascript to...
3
6052
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 to the ASP page they get Oracle client issues. How do I make the script run from the server side to eliminatew any oracle client issues or oracle tns names issues.
7
1397
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
4921
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 fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
12
3120
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 with page reload. When user presses a button on my page most functions should clear the page and repaint it using my wholepage() function. After a couple of repaint the page goes into some error. Am I supposed to clear the div's in the page or wot?...
4
7472
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 new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act accordingly. Now, the way to replace the current document with a new one used to be easy and...
8
7107
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 overwrites the current page. Is there any way I could load a new tab or window, and put the new content into it? Here is the script I am using right now:
0
9355
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9307
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9225
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8234
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6790
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4589
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.