<html>
<head>
<title>Test</title>
<body>
Some Text Before<br>
<script language="javascript">
document.writeln("<a style='color: #00FF00' href='test.htm'>Link Text
in the Middle</a>");
</script>
<br>Some Text After
</body>
</html>
--
Martin Honnen
http://javascript.faqts.com/
http://home.t-online.de/home/martin.honnen/jsgoddies.html
Thanks,
Tommy
I've also had some personal trouble with Netscape and document.writeln(). You
might at least check to see if document.write() works for you instead.
David
Tommy Carter wrote:
>
> After I replied to this the first time, I looked into styles a bit more and
> found out how to specify a named style using the tag's ID attribute. That
> works for me on both browsers. Thanks for the suggestion. For reference, if
> anyone knows why the javascript doesn't work, I'd like to know.
NN4 and inline style causes trouble, you don't even need js to get that.
>
> Thanks,
I was trying to keep the post short, so I didn't explain fully. I'm using JS to
sniff the browser and write out the appropriate HTML for layering on IE and NS.
Although they both support the DIV tag, NS screws up the positioning. Therefore, I
need a layer tag written out if the browser is NS4+. Also, if the browser is
neither NS4+ or IE4+, the HTML for the popup menu layer doesn't get written out at
all. Part of the HTML for the popup menu is the excerpt that I posted. That's why
I'm using JS to write out a statement that includes the style attributes.
Tommy
I was originally using document.write() with the same problem. I tried switching
the quotes as you suggested with no difference. The colon doesn't appear to be the
real problem. I wrote out the same statement, using a bogus tag instead of the
STYLE tag and it worked fine. It appears to be a problem with NS and inline styles
in CSS format. Thanks for the input.
Tommy