473,405 Members | 2,261 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,405 software developers and data experts.

problem creating a dynamic file/frame pointer in js

Supposedly, the code below should assign the correct value to the
'url' variable.
But all I get is a blank 'main' Frame with apparently nowhere to go
when I
click
on the link in the 'menu' Frame..
Worst(yesyes!!)
1 - Explorer 6 : clicking a link in the 'menu' frame simple reopens an
instance of the FRAMESET, syntax error msg.
2 - Netscape 7.1 : clicking a link in the 'menu' frame simple reopens
an instance of the FRAMESET, but does not report ANY errors in the
Java console.
3 - Mozilla 5.0: same as Netscape.
Opera 7.23 however WILL (after a little) opens as expected, but
right-clicking a link(open in a new window) does not retrieve the page
name of the clicked link, instead it re-opens the menu page alone in a
new window.

What a headache. Can someone help me please?TIA

<HTML>
<SCRIPT type="text/javascript">
var theData;
var begin;
var url;
begin = top.location.href.indexOf("?");
if (begin > 0 ) {
theData = top.location.href.substring(begin+1,location.href. length);
theData = unescape(theData);
url = "<FRAME name=main src='files/" + theData; + "'>";
} else {
url = "<FRAME name=main src='files/Help.htm'>";
}
</script>
<FRAMESET cols="20%,*" FRAMEBORDER="1" BORDER="1" scrolling="auto">
<noframes>
</noframes>
<FRAME name=menu src='files/menu.html' marginwidth='0'
marginheight='0' target='main'>
<script type="text/javascript">
document.write(url);
<script>
</FRAMESET>
</HTML>
BTW, the code I use at the moment is very inelegant, you can view it
there:
http://philippeoget.50megs.com/
Jul 23 '05 #1
1 1607
Phil wrote:
Supposedly, the code below should assign the correct value to the
'url' variable.
But all I get is a blank 'main' Frame with apparently nowhere to go
when I click on the link in the 'menu' Frame..
Worst(yesyes!!)
[problems with common browsers]
What a headache. Can someone help me please?TIA

[source code]
BTW, the code I use at the moment is very inelegant, [...]


and invalid which is the reason of the errors you noticed.
You might want to consider this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Static frameset (use a better title here)</title>
<script type="text/javascript">
if (typeof document != "undefined"
&& typeof document.open != "undefined"
&& typeof document.write != "undefined"
&& typeof document.close != "undefined")
{
var mainSrc = "Help.htm";
var s = "";
if (typeof top != "undefined"
&& typeof top.location != "undefined"
&& typeof top.location.search != "undefined"
&& typeof top.location.search.replace != "undefined"
&& (s = top.location.search.replace(/^\?/, ""))
{
mainSrc = typeof unescape != "undefined" ? unescape(s) : s;
}

document.open("text/html");
document.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"'
+ ' "http://www.w3.org/TR/html4/frameset.dtd">'
+ '<html>'
+ '<head>'
+ '<title>Frameset generated by client-side script'
+ ' (use a better title here, maybe dynamic)<\/title>'
+ '<\/head>'
+ '<frameset cols="20%,*">'
+ '<frame name="menu" src="files/menu.html" marginwidth="0"'
+ ' marginheight="0">'
+ '<frame name="main" src="files/' + mainSrc + '">'
+ '<noframes>'
+ '<body>'
+ 'useful alternative content'
+ '<\/body>'
+ '<\/noframes>'
+ '<\/frameset>'
+ '<\/html>');
document.close();
}
</script>
</head>

<frameset cols="20%,*">
<frame name="menu" src="files/menu.html" marginwidth="0"
marginheight="0">
<frame name="main" src="files/Help.htm">

<noframes>
<body>
useful alternative content
</body>
</noframes>
</frameset>
</html>

This will at least be valid and will not exclude users without
client-side script support. However, a server-side solution
will be much less error-prone and much more performant.
PointedEars
Jul 23 '05 #2

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

Similar topics

1
by: David | last post by:
Hello I'm writting an apllication and i like to display and offscreen image. However my code doesn't seem to work. It compiles and runs properly but What i want is to associate the button of the...
0
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out...
3
by: Tony Johansson | last post by:
Hello Experts!! I have two small classes called Intvektor and Matris shown below and a main. Class Intvektor will create a one dimension array of integer by allocate memory dynamically as you...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
13
by: xian_hong2046 | last post by:
Hello, I think dynamic memory allocation is supposed to be used when one doesn't know in advance how much memory to allocate until run time. An example from Thinking in C++ is to dynamically...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
1
by: aeroumr | last post by:
In the following code, I have created a panel with a button and a textctrl object on it. I have also created a menubar that will create a new text file (i.e. textctrl object). My problem is that...
0
by: ishakteyran | last post by:
I am İshak Teyran , the data manager of a team which attends to IBM XML Challenge Turkey , we are trying to build a dynamic web project in Rational Software Architect 7.5, WAS 7.0 , DB2 9.5 EE. ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.