473,803 Members | 3,306 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to access the parent element?

31 New Member
Hello, I am working in javascript and I need to access the parent element. I have 4 different html documents in the same folder.
The names are title, code, golf,tree. I am currently in the title document and I want to access a frame in the code document. I am new to programming in javascript and I know this is simple. Can someone please point me in the right direction.
Nov 9 '08 #1
22 5299
gits
5,390 Recognized Expert Moderator Expert
could you please post the html that is relevant for this question. are all pages currently loaded when you want to access them?

kind regards
Nov 9 '08 #2
waltapp
31 New Member
[HTML]<!--
New Perspectives on JavaScript
Tutorial 6
Case Problem 3



Filename: title.html
Supporting files: title.css

-->
<title>Web Design Demo Control Buttons</title>
<link href="title.css " rel="stylesheet " type="text/css" />

<script src="" type="text/javascript"></script>

<script type="text/javascript">

function showPreview()

"100,*,1".

</script>
</head>
[/HTML]
This is the code I have so far. I believe in this exercise all pages will be loaded. This is the parent page. In the previous post I made up some of the names as I did not feel they were relevant. The actual names of the other pages are css dem and html with the html extension. All pages are to load into frames. This is my first project involving objects at this level. If you can just point me in the right direction I would greatly appreciate it.

Thanks
Nov 9 '08 #3
gits
5,390 Recognized Expert Moderator Expert
is this page loaded in a frame? you said that you need to access the parent ... so show the parent page ...

kind regards
Nov 9 '08 #4
waltapp
31 New Member
[HTML]
<html>
<head>
<!--
New Perspectives on JavaScript
Tutorial 6
Case Problem 3

Web Design Demo

Filename: demo.html
Supporting files: css.htm, html.htm, title.htm
-->

<title>HTML Demo</title>
</head>

<frameset rows="100,210,* " id="demo" name="demo">
<frame name="title" id="title" src="title.htm" scrolling="no" />
<frameset cols="*,*">
<frame name="code1" id="code1" src="html.htm" />
<frame name="code2" id="code2" src="css.htm" />
</frameset>
<frame name="output" id="output" />
</frameset>

</html>
[/HTML]
I have to appologize. I gave you the wrong parent. This course is very poor in its element to teach which is why I need to look for outside resources. I should have clued in earlier by the lack of a frameset.
Thanks.
This page is demo.html
I need to access the demo page from the title page.
Nov 9 '08 #5
gits
5,390 Recognized Expert Moderator Expert
from a page that is loaded into a frame you may use:

Expand|Select|Wrap|Line Numbers
  1. parent.frames
for example to get the list of frames at the parent level. so you could try:

Expand|Select|Wrap|Line Numbers
  1. alert(parent.frames.length);
kind regards
Nov 9 '08 #6
waltapp
31 New Member
from a page that is loaded into a frame you may use:

Expand|Select|Wrap|Line Numbers
  1. parent.frames
for example to get the list of frames at the parent level. so you could try:

Expand|Select|Wrap|Line Numbers
  1. alert(parent.frames.length);
kind regards
Thanks, I will try that out.
Nov 9 '08 #7
gits
5,390 Recognized Expert Moderator Expert
btw. are you using this book ... is this all home-/coursework? ...

as long as you show effort to solve the problem for your own first ... we could go on with it :)
Nov 9 '08 #8
waltapp
31 New Member
I am curious. I was wondering if the statement

windows.frames is equivalent to parent.frames.
Nov 9 '08 #9
waltapp
31 New Member
Yes, this book is part of a long distance learning that I am enrolled in. I am enjoying the course but the time required to figure out some of these simple things that with a little guidance is easy is a little discouraging. I am happy to find this forum. Thank you for your assistance. I will be an active participant.
Nov 9 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
19784
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following test case element1 and element2 should be placed side by side inside a centered white container element: http://www.markusernst.ch/test.htm
0
2902
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is loaded with historical data read from an XML file. The second dataSet has current data filled from a dataGrid.
4
2236
by: jarek | last post by:
Hi, this is my code: CSSStyleDeclaration.prototype.__defineSetter__('display', displaySetter); function displaySetter(value) { var parent = findParent(document, this); if (parent) {
4
2923
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a child element with an attribute set at a given value; maybe an example is more self-explaining... Given the following input XML document:
1
4655
by: Roy | last post by:
Hi, I have a parent document which has an iframe loaded in it. The iframe has an textfield element. I want to access this textfield element from the parent document. I have tried the following. But that doesn't work. (from the parent) window.frames.document.getElementById('idname')
3
11928
by: karthickdevi | last post by:
Hi, I have an iframe , say 'iframe01' in my parent document. In the same parent document, i have a div tag and inside the div tag, i have another iframe, say 'iframe02'. Now i want to access the iframe01 element from the iframe02. Please suggest me how can i do it. I have tried the following, but i get as undefined.
5
10473
by: Mel | last post by:
I need to access an element of my top window from inside an IFrame within that window. I tried: parent.MYFRAME.document.getElementById("LHS"); and i get a "Access Denied" is there a way to do this ?
0
2584
by: Guzeppi | last post by:
Hi, i'm using linq to load an xml structure into my classes. the xml consists of the same node nested for multiple levels e.g. <node id="node_id01" name="node 01"> <node id="node_id0101" name="node 01 01"> <node id="node_id010101" name="node 01 01 01"> <node id="node_id01010101" name="node 01 01 01 01"> <node id="node_id0101010101" name="node 01 01 01 01 01">
1
3804
by: bnchs | last post by:
This is C code. I am trying to fill each node's Parent field with its parent because I am drawing nodes to the screen. However, I have not been able to get this working. Reading the output from the code and tracing it, it seems that the code does not continue recursing down into the tree to insert. Can someone please point me to what is wrong and help me understand why it is wrong? Thank you. struct AvlNode* Insert( gint X, struct AvlNode*...
0
9700
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
9564
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
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
10310
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...
0
10068
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7603
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
6841
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.