473,701 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

split() one document.frames not allowed

Hi,

I want to split the result from
window.frames['data_frame'].document.locat ion;, this in order to find
out which page is currently opened in the specific frame. When I do it
like this:
var source = window.frames['data_frame'].document.locat ion;
// var source = "W3Schools is great!";

index_source = source.split('/');
IE gives an error that this method or property is not supported by this
object. When I check it on the other var it is accepted. Is there any
way I can make this work? I already tried to do it with
document.getEle mentById().src etc.. but that is not very reliable.

Thanks in advance, Maarten

Jul 23 '05 #1
2 2203
Lee
Muffinman said:

Hi,

I want to split the result from
window.frame s['data_frame'].document.locat ion;, this in order to find
out which page is currently opened in the specific frame. When I do it
like this:
var source = window.frames['data_frame'].document.locat ion;
// var source = "W3Schools is great!";

index_source = source.split('/');
IE gives an error that this method or property is not supported by this
object.


The location attribute of a document is not a string (it's a Location object),
and so doesn't have a split() method. I believe the href attribute of Location
is a string, so:

window.frames['data_frame'].document.locat ion.href.split( '/');

should work.

Jul 23 '05 #2
Lee wrote:
Muffinman said:

Hi,

I want to split the result from
window.frame s['data_frame'].document.locat ion;, this in order to findout which page is currently opened in the specific frame. When I do itlike this:
var source = window.frames['data_frame'].document.locat ion;
// var source = "W3Schools is great!";

index_source = source.split('/');
IE gives an error that this method or property is not supported by thisobject.
The location attribute of a document is not a string (it's a Location

object), and so doesn't have a split() method. I believe the href attribute of Location is a string, so:

window.frames['data_frame'].document.locat ion.href.split( '/');

should work.


document.locati on has been deprecated for years, replaced by
document.URL (read-only by spec, read/write in - you guessed it). A
window's Location object is found at window.location , although it
appears that virtually all browsers now map document.locati on to
window.location , possibly to avoid errors. Because of the importance of
[window.]location it can be read directly as a string, or replaced with
a string. Of course, it isn't a string, and one thing you can't get
away with, as Lee noted, is to invoke String object methods on it.
Could do this:

function getURL(doc)
{
var m = null;
if (m = doc.URL.match(/[^\/\\]+$/))
return m[0];
return '';
}

alert(getURL(fr ames.data_frame .document));

Jul 23 '05 #3

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

Similar topics

9
2493
by: Tom Szabo | last post by:
Hi All, I need some advice on how to split a page where a top section, something like a banner stays stationery, and the rest can be scrolled. Normally this would be done using framesets, two frames would do the job. Unfortunately since all the code is generated from PHP I would need to assign separate scripts to each frame, and this is what I am trying to avoid if possible.
5
1865
by: imaband | last post by:
Hi, I've got a little Quizzer program that asks a question in the upper frame of a frameset and then lists the answer in the lower frame. Answers can be plain text, straight html, a sound, or a LINK. I have a function that builds the answer frame using document.write(among other things). This code works fine until you encounter a link. It dutifully displays the link in the lower frame but the very next question builds the newContent...
7
2324
by: David Hayes | last post by:
I tried finding an answer on http://www.quirksmode.org/ without success. I am attempting a complicated Frames structure. I have made it work in IE, but not Netscape. I begin with three frames, where the two lower ones are within a Frameset within the master Frameset: 1111111111111111111
3
2445
by: Jan Ebbe Jensen | last post by:
Hi I have tried the following code. It works in Mozilla. In IE I'm not able to enable DesignMode? What have I done wrong? It says that obj is undefined? Can anyone help me please.
8
9415
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the document.write( ) method? For a simplified example, I have two Web pages. Page 1 uses JavaScript with the following: htmlData = "<B>This is bold text.</B>"; document.write(htmlData);
3
4915
by: thompson_38 | last post by:
I am currently working on a C# application that uses an axWebBrowser control which displays HTML pages. This is being done to reuse an existing web application which resides on a client's computer. I have created a resource .dll linking in all of the HTML, images and JavaScript pages in the old project. Using the res://mydll/homepage.htm, the home page loads into the web browser control (axWebBrowser.Navigate). This page has frameset,...
1
8371
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As you can see, there could have been a problem with the split-method. The following short article handles ways around this possible problem, that we couldn't reproduce, but someone may possibly encounter it too sometimes. If nothing else, the shown...
56
3840
by: Deepan HTML | last post by:
Hi All, Currently i am working in a framed environment where i have divided the window as 20% and 80% and the 20% is used for navigation purpose and right frame for displaying the orignal content. Now i want to Disable ad Enable the menu items which are placed in the left frame for navigation purpose. Can any of you input me with any idea as how to proceed? If you need any other information then please let me know.
23
6605
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to use it? IE5 or IE6? Thanks
0
8737
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9232
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9084
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7827
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6573
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4411
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.