Hi all,
When I use the document.write() function, the output of the function is written to a white screen, I want it to go to the same screen below the existing table. Any ideas?
Thanks,
Direwolf
JavaScript; document.write()
Moderator: General Moderators
maybe this is helpful http://www.pxl8.com/innerHTML.html
I had the same problem a while back. The problem is that the webpage can't be altered once it's displayed on the screen--unless you use DHTML (Dynamic HTML).
The hardest part of DHTML is making it work in both IE and Netscape. They use different methods for changing the content of the webpage.
Here's something to get you started:
Code: Select all
<input type="button" onClick="hello_world()" value="Click me"><br><br>
<span id="preview_text_ie"></span>
<layer id="preview_text_ns"></layer>
<script language="JavaScript">
<!--
function hello_world()
{
var ie = document.all && (navigator.appVersion.indexOf("Mac") == -1);
var ns = document.layers;
if (ie) // Using IE
{
document.allї"preview_text_ie"].innerHTML = "Hello World";
}
else if (ns) // Using netscape
{
document.preview_text_ns.document.write("Hello World");
document.preview_text_ns.document.close();
}
}
//-->
</script>gnu2php,
In your example it implies only IE4+ supports .innerHTML. Actually, NS6 does too. And for NS4, you would use the LAYER tag, such as:
I've written a tutorial a while back on dynamically changing text/content in IE4/NS4/NS6 here: http://www.javascriptkit.com/javatutors ... tent.shtml
In your example it implies only IE4+ supports .innerHTML. Actually, NS6 does too. And for NS4, you would use the LAYER tag, such as:
Code: Select all
<script>
function changeit(){
document.test.document.write("<big>How are you doing?</big>")
document.test.document.close()
}
</script>
<LAYER id="test" width=200px height=20px><big>My name is Bob</big></LAYER>
<br><br><form>
<input type="button" onClick="changeit()" value="Click here">
</form>h3h3, I like those scripts 
http://www.pxl8.com/innerHTML.html shows how to use DOMHtml to perform things like innerHTML/Text. Will probaby use it from now on since I like it's capabilities. Unfortunally there are still some annoying bugs or incomplete implementations in the browser-enginges (seems that mozilla/netscape can score at this point)
http://www.pxl8.com/innerHTML.html shows how to use DOMHtml to perform things like innerHTML/Text. Will probaby use it from now on since I like it's capabilities. Unfortunally there are still some annoying bugs or incomplete implementations in the browser-enginges (seems that mozilla/netscape can score at this point)
I've learned that Netscape (since 6.0) has changed it's way of doing DHTML. See http://developer.apple.com/internet/jav ... dhtml.html
So, my example above won't work with it.
So, my example above won't work with it.
Good Reference on DHTML related issues
Everyone,
I recommend taking a look at Danny Goodman's book from O'Reilly press called "Dynamic HTML" ISBN 0-569-00316-1 for discussions on the DOM elements that are available for both Netscape & IE.
There are issues with using the <LAYER> tags - mostly because they are being phased out by the new HTML 4 standards, and will not work in 'strict' DTD's (although I have found that IE 6 sometimes still does it anyway!!).
I have been fighting a similar problem and run up against problems accessing the DOM (Document Object Model) that DHTML uses to perform dynamic updates from within PHP. If needed I can generate some code that will call JavaScript or VBScript event handlers from within PHP generated pages, but what I REALLY want to know is how to simply access the DOM directly from within PHP, or perhaps more correctly, to call PHP Event Handlers from within HTML.
Please see my post:
viewtopic.php?t=5636
If anyone has any insight on this I would appreciate the pointers. Thanx.
-Westmo
I recommend taking a look at Danny Goodman's book from O'Reilly press called "Dynamic HTML" ISBN 0-569-00316-1 for discussions on the DOM elements that are available for both Netscape & IE.
There are issues with using the <LAYER> tags - mostly because they are being phased out by the new HTML 4 standards, and will not work in 'strict' DTD's (although I have found that IE 6 sometimes still does it anyway!!).
I have been fighting a similar problem and run up against problems accessing the DOM (Document Object Model) that DHTML uses to perform dynamic updates from within PHP. If needed I can generate some code that will call JavaScript or VBScript event handlers from within PHP generated pages, but what I REALLY want to know is how to simply access the DOM directly from within PHP, or perhaps more correctly, to call PHP Event Handlers from within HTML.
Please see my post:
viewtopic.php?t=5636
If anyone has any insight on this I would appreciate the pointers. Thanx.
-Westmo