Posted: Wed Feb 05, 2003 12:56 pm
Can u show it to me in javascript show that i can see the difference! u r right ita takes a lot of computing time in web server!!!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
if(strlen($keimeno) == $_SESSION['i'])
header("Refresh: 1; URL=http://localhost/test.php");
else
session_destroy();Code: Select all
<html>
<head>
<script type="text/javascript">
var textToShow = "just a test";
var pos = 0;
var tm;
function init()
{
tm = setInterval("type()", 200);
}
function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("divText");
d.appendChild(document.createTextNode(textToShow.charAt(pos++)));
}
else
clearInterval(tm);
}
</script>
</head>
<body onload="javascript:init();">
<div id="divText" style="border: 5px solid yellow; width: 200px; height: 50px;">
</div>
</body>
</html>Code: Select all
<?php
...
$file_data = file("data.txt");
$file_diary = file("diary.txt");
?>
<head>
<script type="text/javascript">
var textToShow = "<?php echo addslashes(join('', $file_data)); ?>";
var pos = 0;
var tm;
function init()
{ tm = setInterval("type()", 200); }
function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("textbox");
d.appendChild(document.createTextNode(textToShow.charAt(pos++)));
}
else
clearInterval(tm);
}
</script>
</head>
<body bgproperties='fixed' background='pics/anemos.bmp' onLoad="init();">
...
<center>
<table border='1' cellspacing='1' width='90%' id='AutoNumber1' bordercolor='Yellow' style='border-style: solid; border-width: 5' background='pics/brick.jpg'>
<tr>
<td id="textbox" align="center"
style="color: lightblue; border-color: #ffcc00;
font-size: small; font-family: 'Com,Times New Roman',Times,serif';" >
</td>
</tr>
</table>
...Code: Select all
function init()
{ tm = setInterval("type()", 200); }Code: Select all
function type()
{
if (textToShow.length != pos) // if we're not already "behind" the end
{
d = document.getElementById("divText");
d.appendChild(document.createTextNode(textToShow.charAt(pos++)));
}
else
clearInterval(tm);
}Code: Select all
function type()
{
if (textToShow.length != pos)
{
// finding a reference to the element with the id divText
d = document.getElementById("divText");
// getting the char fromthe current position in the text
c = textToShow.charAt(pos);
// making a new text-node from this char
n = document.createTextNode(c);
// appending this new text to the currently displayed text
d.appendChild(n);
// moving to the next position
pos++;
}
else
clearInterval(tm); // no more text, so clear the interval
}Code: Select all
<html>
<head>
<script type="text/javascript">
// marking a new line with a single chr(13), so this will lead to 2 lines:
var textToShow = "just a test"+String.fromCharCode(13)+"and a second line";
var pos = 0;
var tm;
function init()
{
tm = setInterval("type()", 200);
}
function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("divText");
c = textToShow.charAt(pos++);
// checking wether this marks a new line or not
if (c.charCodeAt(0) != 13)
// simple text, just append it as before
d.appendChild(document.createTextNode(c));
else
// a new line, so insert a linebreak-element
d.appendChild(document.createElement("br"));
}
else
clearInterval(tm);
}
</script>
</head>
<body onload="javascript:init();">
<div id="divText" style="border: 5px solid yellow; width: 200px; height: 50px;">
</div>
</body>Code: Select all
<?php $file_data = array_map('trim', $file_data); ?>Code: Select all
<?php $file_data = array_map('addslashes', $file_data); ?>Code: Select all
<?php $file_data = join('', $file_data); ?>Code: Select all
<?php $file_data = join('"+String.fromCharCode(13)+"', $file_data); ?>Code: Select all
var textToShow = "<?php $file_data ?>";Code: Select all
<?php
$file_data = file("data.txt");
?>
<html><head>
<script type="text/javascript">
var textToShow = "<? echo join('"+String.fromCharCode(13)+"', array_map('addslashes', (array_map('trim', $file_data)))); ?>";
var pos = 0;
var tm;
function init()
{ tm = setInterval("type()", 50); }
function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("divText");
c = textToShow.charAt(pos++);
if (c.charCodeAt(0) != 13)
d.appendChild(document.createTextNode(c));
else
d.appendChild(document.createElement("br"));
}
else
clearInterval(tm);
}
</script>
</head>
<body onload="javascript:init();">
<div id="divText" style="border: 5px solid yellow; width: 200px; height: 50px;">
</div>
</body>
</html>Code: Select all
<html>
<head>
<script type="text/javascript">
// marking a new line with a single chr(13), so this will lead to 2 lines:
var textToShow = "just a test"+String.fromCharCode(13)+"and a second line";
var pos = 0;
var tm;
function init()
{
tm = setInterval("type()", 100);
}
function type()
{
if (textToShow.length != pos)
{
d = document.getElementById("divText");
c = textToShow.charAt(pos++);
// checking wether this marks a new line or not
if (c.charCodeAt(0) != 13)
// simple text, just append it as before
d.appendChild(document.createTextNode(c));
else
// a new line, so insert a linebreak-element
d.appendChild(document.createElement("br"));
}
else
clearInterval(tm);
}
</script>
</head>
<body onload="javascript:init();" style="background-color: darkblue">
<table border="1" style="background-image: url('test.png')">
<tr>
<td >1</td>
<td id="divText" style="border: 5px solid yellow; width: 400px; height: 400px; color: lightblue; font-size: small; font-family: 'Com,Times New Roman',Times,serif';">
</td>
</tr>
<tr><td>3</td><td>4</td></tr>
</table>
</body>
</html>Code: Select all
<div id="divText" align="left" style="border: 5px solid yellow; width: 900px; height: 500px;">
<font face='Com' size='4' color='LightCyan'>
</div>Code: Select all
<div ...>
<font ...></font>
<!-- append child will take place here, outside the font-tag -->
</div>