Instead of document.write statement, put the <iframe id=...
name=...></iframe> code into HTML directly - without a src argument.
after that code, run your script to give a src (better be location.href) for
instants: document.frames('name_of_the_iframe').location.hre f=...;
This way you will not meet any trouble.
ccton
--
www.vicdir.com
"Jim Marquardson" <ji*@marqorp.com>
I worked some more at the problem, and I solved it with your code. It
took some more coding to make your solution work, but it ended up
being the best solution. I thought I'd post what I ended up doing.
A sample link would be <a
href="PageWithFrame.html?nonDefaultContent.html">L ink</a>
Then, the HTML file:
<html>
<head>
<script>
function writeFrame() {
page = "defaultContent.htm"; //the default page
if(location.search /*&& isFile(location.search.substring(1))*/) {
page = location.search.substring(1);
}
document.write("<iframe src=\"" + page + "\" id=\"myIframe\"
name=\"myIframe\" width=\"800\" scrolling=\"no\"
frameborder=\"0\"></iframe>\"");
}
</script>
</head>
<body>
This is the page. Content goes here.
<script>writeFrame();</script>
</body>
</html>
I had too many problems trying to change the src of the iframe on
loading (usually because the iframe hadn't completed loading), so I
decided to write out the correct src the first time. That way, I
don't have to worry about changing it.
Thanks for you help,
Jim