Forum Moderators: phranque
Here's a basic example of what I'm doing. Any help would be greatly appreciated!
index.html
<HTML><HEAD><TITLE>Venmar's Intranet</TITLE>
<LINK REL="icon" HREF="/favicon.png" TYPE="image/png">
<LINK REL="shortcut icon" HREF="/favicon.ico">
</HEAD>
<FRAMESET ROWS="65,*" FRAMESPACING="0" FRAMEBORDER="1" BORDER="1">
<FRAME FRAMEBORDER="1" SCROLLING="no" MARGINWIDTH="0" MARGINHEIGHT="0" NORESIZE SRC="navbar.html" NAME="navbar">
<FRAME FRAMEBORDER="1" SCROLLING="auto" MARGINWIDTH="0" MARGINHEIGHT="0" NORESIZE SRC="body.html" NAME="main">
<NOFRAMES>
Your browser doesn't support frames. Please upgrade your browser to current release.
</NOFRAMES>
</FRAMESET>
</HTML>
navbar.html
hello
body.html
hello
<SCRIPT LANGUAGE="JavaScript" TTYPE="text/javascript">
function fnTest()
{
document.write("hello world");
}
</SCRIPT>
<FORM>
<INPUT TYPE="text" NAME="test" onChange="fnTest()">
</FORM>
To do something like this after the page has loaded you will need to write it to an object that can change, like an input field.
So, for example:
<script type="text/javascript">
function fnTest()
{
document.form1.bob.value='hello world';
}
</script><form name="form1">
<input type="text" onChange="fnTest()">
<input type="text" name="bob" readonly>
</form>
HTH
On reflection there is a way that you could do this, using the javascript innerText method.
<form name="form1">
<input type="text" onChange="fnTest2()">
</form><script type="text/javascript">
function fnTest2()
{
document.getElementById('daLayer').innerText='hello world';
}
</script><div id="daLayer"> </div>
This will then populate the layer, daLayer, with the text that you have specified.
Caveat: This will only work in IE and Opera.
My example code above was a general idea to allow the client to open a document after they provided a path/file name. I've resolved this using a button. Thanks.
Now I still want to do the same thing again with document.write (as I stated in my example above), but this time based on a form field to toggle text color between two colors. This would depend on if the value of another form field is disabled/readonly or not disabled/readonly (true/false). Can this be done doing JavaScript?
Is this problem a fact of it not working in Netscape 6+/Mozilla because of a bug or lack of current support?
Your second assumption is correct - they just don't support it at this time.
but this time based on a form field to toggle text color between two colors.
This is slightly easier to achieve. You could wrap the text in question in a span, give that span an ID and then change the style property of that ID using:
document.getElementById.style.color='blue';
Again, this is DOM1 compliant only, you would need to add some conditionals in to deal with older browsers.