473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

problem with insertAdjacentHTML

Hi all,

I am trying to use the code below so as to create a frame source string
dynamically. The idea is to verify if this index page is the parent or if it
called by an orphan page, in which case the orphan page passes its own name
as an argument to the index page.
Unfortunately, the code below returns an unspecified error.
This code is what is intended to create the index.htm page as it opens.

<HTML><TITLE>....</TITLE>

<SCRIPT type="text/javascript">
function window.onload()
{
checklocation();
}
function writetop()
{
document.body.insertAdjacentHTML('beforeEnd','<FRA MESET cols=20%,*
FRAMEBORDER="1" BORDER="1" scrolling=auto>')
document.body.insertAdjacentHTML('beforeEnd','<nof rames>')
document.body.insertAdjacentHTML('beforeEnd','</noframes>')
}
function writebottom()
{
document.body.insertAdjacentHTML('beforeEnd','</FRAMESET>')
document.body.insertAdjacentHTML('beforeEnd','</HTML>')
}
function checklocation()
{
//alert(top.location.href.length);
var theData;
var begin;
begin = top.location.href.indexOf("?");
if (begin > 0 )
{
theData = top.location.href.substring(begin+1,location.href. length);
theData = unescape(theData);
writetop();
document.body.insertAdjacentHTML('beforeEnd','<FRA ME name=main
src="files/ + theData + ">')
}
else{
writetop();
document.body.insertAdjacentHTML('beforeEnd','<FRA ME name=main
src="files/Help.htm">')
}
writebottom();
}
</script>
<body>

</body>
</html>
TIA
Phil
http://uk.geocities.com/philippeoget/a2z/
Jul 23 '05 #1
3 5796
Here is perhaps a simplier way to accomplish your goals:

<HTML><TITLE>....</TITLE>

<SCRIPT type="text/javascript">
//alert(top.location.href.length);
var theData;
var begin;
var url = "files/Help.htm";
begin = top.location.href.indexOf("?");
if (begin > 0 )
{
theData = top.location.href.substring(begin+1,location.href. length);
theData = unescape(theData);
url = "files/ + theData;
}
</script>
<FRAMESET cols="20%,*" FRAMEBORDER="1" BORDER="1" scrolling="auto">
<script type="text/javascript">
document.write("<FRAME name=main src='"+ url+"'>";
</script>
</FRAMESET>
</html>
One thing to notice is that you are missing a FRAME definition. I don't know
if that is intentional or not but perhaps that is the reason for your error
because you specify 2 frames in your frameset (cols="20%,*) but then only
define one.


Jul 23 '05 #2

The missing frame reference was unintentional but is present in the
'real' frameset.
In regard to your code: simple and graceful are 2 words that come to
mind.

Many thanks

Philippe
http://uk.geocities.com/philippeoget/
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Mike wrote:
Here is perhaps a simplier way to accomplish your goals:

<HTML><TITLE>....</TITLE>

<SCRIPT type="text/javascript">
//alert(top.location.href.length);
var theData;
var begin;
var url = "files/Help.htm";
begin = top.location.href.indexOf("?");
if (begin > 0 )
{
theData = top.location.href.substring(begin+1,location.href. length);
theData = unescape(theData);
url = "files/ + theData;
}
</script>


You are missing quotes after "files/
Even simpler below?
<SCRIPT type="text/javascript">
var url = "files/Help.htm";
if (top.location.search ){
url = "files/" + unescape(top.location.search.substring(1))
}
</script>

Mick
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
8
by: Jeff Thies | last post by:
To my surprise, insertAdjacentHTML is not supported in Netscape. Can this be prototyped, or are there similar DOM 2 methods? Jeff
6
by: dexter | last post by:
hi everyone, I am writing an extension to a third party application. this application generates code dynamically using insertAdjacentHTML(). I want to execute my function whenever the...
2
by: sveinn | last post by:
Hi all, I've read through this group searching for an answear about this problem. Few have come close but not quite what I need. My problem is this: I'm using Ajax to fetch a new table with...
1
by: Dmitry Kulinich | last post by:
how to insertAdjacentHTML/Element for iframe ? it looks that it is not enought info in MSDN : ( -- Thank you, De Cool, EPE
4
by: VAXman- | last post by:
I have been trying to copy a DIV in an IFRAME to the TOP DOCUMENT. The code does the following iframeDIV = document.getElementById('div_in_iframe'); var clonedDIV =...
0
by: sejal17 | last post by:
Hello everyone, i have a problem with getting a print out of iframe in asp.net with language c#. an iframe contain a data from diffrent page(docoment1.htm). can any one help me in this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.