473,563 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.doc ument;
alert(bannerFra me.name);
alert(bannerDoc .URL);
}
// -->
</script>
</head>
<frameset frameborder="0" rows="10%,*" onLoad="load(); ">
<frame id="banner" name="banner"
src="banner.htm " noresize="nores ize" scrolling="no"
onLoad="bannerF rame=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 1159
Ken Kast wrote:
I have a frameset page with the following code snippets:

.
.
.
<script type="text/javascript">
<!--
var bannerFrame;
function load () {
var bannerDoc = bannerFrame.doc ument;
alert(bannerFra me.name);
alert(bannerDoc .URL);
}
// -->
</script>
</head>
<frameset frameborder="0" rows="10%,*" onLoad="load(); ">
<frame id="banner" name="banner"
src="banner.htm " noresize="nores ize" scrolling="no"
onLoad="bannerF rame=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.fr ames['banner'].location.href) ;
}
</script>
</head>
<frameset frameborder="0" rows="10%,*" onload="load(); ">
<frame id="banner" name="banner"
src="about:blan k" noresize="nores ize" 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=thi s), then it fails
in both Opera and Netscape 4 with "bannerFram e undefined".

--
| Grant Wagner <gw*****@agrico reunited.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
5214
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 separate words separated by two dots/periods. User can enter "xyz.." also. Minimum two dots/periods must be present. Here is my code, it works...
7
2150
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 how to create an XPath statement asking for the "last node with a value less than" a given value. I need this to be able to ask "Where was Scott...
2
3272
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 changes. I'm implementing this for firefox. right now, i have a web page opening that contains that info, but i would rather have a pop up alert()...
6
7064
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 xdStructure.Load(Server.MapPath("~/xml/Structure.xml"))
2
4725
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 sub-elements. Heads ->(0..*)Head -> ...subelements... -> (0..*)Row The problem I have is that I find the wrong Row elements, ie I always find...
0
5690
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 document. The webpages, database and XML are all UTF-8, however every now and then I get an error in the XML parser that tells me I have an invalid...
4
6347
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 left attributes. I have defined my element like so... ### .css file... #mydiv { position:absolute;
12
3377
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, etc.). Pretty much all of the functionality is working except a feature that shows in which line of the HTML source a violation of the user-set rule...
275
12113
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
7659
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...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
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...
1
7634
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...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
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...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.