473,382 Members | 1,809 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,382 software developers and data experts.

split() one document.frames not allowed

Hi,

I want to split the result from
window.frames['data_frame'].document.location;, 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.location;
// 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.getElementById().src etc.. but that is not very reliable.

Thanks in advance, Maarten

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

Hi,

I want to split the result from
window.frames['data_frame'].document.location;, 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.location;
// 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.location.href.split('/');

should work.

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

Hi,

I want to split the result from
window.frames['data_frame'].document.location;, 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.location;
// 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.location.href.split('/');

should work.


document.location 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.location 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(frames.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
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...
5
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...
7
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...
3
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
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...
3
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...
1
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...
56
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....
23
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.