Closed Thread Icon

Topic awaiting preservation: targeting this into a table or div (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=9022" title="Pages that link to Topic awaiting preservation: targeting this into a table or div (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: targeting this into a table or div <span class="small">(Page 1 of 1)</span>\

 
new user
Neurotic (0) Inmate
Newly admitted

From: N Ireland
Insane since: Nov 2003

posted posted 02-13-2004 17:05

Hi
Can someone tell me how I can get this to be displayed in a table or div on the same page as the one thats just loaded. Darn thing keeps being shown in a totally seperate page altogether.
Thanks guys

code:
<html>

<head>
<script>
var Sn=new Date();
var Ss=Sn.getSeconds();
Ss=String(Ss);
var sT=Ss;
function endTimer(){
var En=new Date();
var Es=En.getSeconds();
Es=String(Es);
var eT=Es;
var tT=eT-sT;
var Str='';
Str+='<table border=1 bgcolor=white bordercolor=black align=center height="30" width="300">';
Str+='<tr>';
Str+='<td width="308" height="26">';
Str+='<font size=2 face=Arial>&nbsp;Page load time:<b>'+tT+'</b> seconds</font>';
Str+='</td>';
Str+='</tr>';
Str+='</table>';
document.write(Str);
}
</script>
</head>

<body onload="endTimer()">



smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 02-13-2004 19:41

your problem here is that you are not writing the table into the document until after the document has finished loading <body onload="endTimer()">

you can't use document.write to add stuff to the current page after the page has finished loading - it just opens a new window like you said.

basically there are a few options avaible for this sort of thing:

1. put the table code into the plain html and then use a text area/field to display the page load time. Since text areas can have their value changed after the page has loaded.

2. use innerHTML to add the table to a specified part of the document onload.

3. manipulate the dom - 'nicest' way, not the simplest method tho. innerHTML is easier.

<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit

new user
Neurotic (0) Inmate
Newly admitted

From: N Ireland
Insane since: Nov 2003

posted posted 02-13-2004 21:54

Uhm like this do you mean?

code:
<head>
<script>
var Sn=new Date();
var Ss=Sn.getSeconds();
Ss=String(Ss);
var sT=Ss;
function endTimer(){
var En=new Date();
var Es=En.getSeconds();
Es=String(Es);
var eT=Es;
var tT=eT-sT;
tT=document.getElementById("Str");
dump(tT.innerHTML);
}
</script>
</head>
<body onload="endTimer()">

<script>
var Str='';
document.write(Str);
Str+='<table cellpadding=0 cellspacing=0 border=1 bgcolor=white bordercolor=black align=center height="30"
width="300">';
Str+='<tr>';
Str+='<td width="308" height="26">';
Str+='<font size=2 face=Arial>&nbsp;Page load time:<b>'+tT+'</b> seconds</font>';
Str+='</td>';
Str+='</tr>';
Str+='</table>';
</script>
</body>


Sorry I'm not cut out for writing codes as you can tell

« BackwardsOnwards »

Show Forum Drop Down Menu