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

Finding the right document

I have a frameset page with the following code snippets:

..
..
..
<script type="text/javascript">
<!--
var bannerFrame;
function load () {
var bannerDoc = bannerFrame.document;
alert(bannerFrame.name);
alert(bannerDoc.URL);
}
// -->
</script>
</head>
<frameset frameborder="0" rows="10%,*" onLoad="load();">
<frame id="banner" name="banner"
src="banner.htm" noresize="noresize" scrolling="no"
onLoad="bannerFrame=this;" />
..
..
..
When I run this the first alert message gives me the correct name. The
second alert gives me the url of the frameset page, not of the frame page.
Why is this, and how should I modify the script so that I can grab the
document for the frame?

Thanks.

Ken
Jul 23 '05 #1
1 1148
Ken Kast wrote:
I have a frameset page with the following code snippets:

.
.
.
<script type="text/javascript">
<!--
var bannerFrame;
function load () {
var bannerDoc = bannerFrame.document;
alert(bannerFrame.name);
alert(bannerDoc.URL);
}
// -->
</script>
</head>
<frameset frameborder="0" rows="10%,*" onLoad="load();">
<frame id="banner" name="banner"
src="banner.htm" noresize="noresize" scrolling="no"
onLoad="bannerFrame=this;" />
.
.
.
When I run this the first alert message gives me the correct name. The
second alert gives me the url of the frameset page, not of the frame page.
Why is this, and how should I modify the script so that I can grab the
document for the frame?

Thanks.

Ken


<script type="text/javascript">
function load () {
alert(window.frames['banner'].location.href);
}
</script>
</head>
<frameset frameborder="0" rows="10%,*" onload="load();">
<frame id="banner" name="banner"
src="about:blank" noresize="noresize" scrolling="no" />
</frameset>

Works in IE6SP1, Firefox 0.8, Opera 7.23. In Netscape 4 you get "access
disallowed from scripts at <uri> another domain." but that's probably only
because I'm using about:blank.

If you try it using your code (ie - setting bannerFrame=this), then it fails
in both Opera and Netscape 4 with "bannerFrame undefined".

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2

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

Similar topics

1
by: Sudhakar Doddi | last post by:
Greetings, I am a novice in Javascript and I am not able to succeed finding right regular expression for my requirement. Input in HTML form should be in the format of row.rack.bin i.e three...
7
by: Scott W Gifford | last post by:
Hello, I'm considering using XML to represent a stream of location information, and XPath to do queries against it. I've got most of it figured out (at least on paper), but I can't figure out...
2
by: doug s | last post by:
How would I access the source of a webpage? I would like to get the source, then use a regexp to find text on a webpage. For example, retrieving a counter, or some other text that dynamically...
6
by: Jay Bienvenu | last post by:
I have the following Visual Basic .NET code in an ASP.NET project: ' ... Dim xdStructure As XmlDocument Dim xnStructureRoot As XmlNode xdStructure = New XmlDocument...
2
by: TT (Tom Tempelaere) | last post by:
Hey there, I'm having trouble finding the right XPath expression. The XML file I'm parsing contains an element Heads which contains sereveral Head elements. These Head elements have several Row...
0
by: Ben Holness | last post by:
Hi all, I have a system which allows users to enter a message on a (PHP) website. This message is then put into a (MySQL) Database. A perl script then picks up the message and creates an XML...
4
by: spivee | last post by:
I'm having an odd type of issue. I want to be able to pass an element name in my javascript event and find the location of the element, be it a div, span, img whatever, specifically the top and...
12
by: e271828 | last post by:
Hi, I'm helping to work a developer tool that verifies a given HTML element has a given attribute (e.g., that all LABEL elements have a FOR attribute, all INPUT elements have an ID attribute,...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.