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.
22 5242 gits 5,390
Expert Mod 4TB
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
[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
gits 5,390
Expert Mod 4TB
is this page loaded in a frame? you said that you need to access the parent ... so show the parent page ...
kind regards
[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.
gits 5,390
Expert Mod 4TB
from a page that is loaded into a frame you may use:
for example to get the list of frames at the parent level. so you could try: - alert(parent.frames.length);
kind regards
from a page that is loaded into a frame you may use:
for example to get the list of frames at the parent level. so you could try: - alert(parent.frames.length);
kind regards
Thanks, I will try that out.
gits 5,390
Expert Mod 4TB
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 :)
I am curious. I was wondering if the statement
windows.frames is equivalent to parent.frames.
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.
gits 5,390
Expert Mod 4TB
I am curious. I was wondering if the statement
windows.frames is equivalent to parent.frames.
i guess you mean:
? this is not equivalent except you are in the top window. otherwise it gives you the frames-collection for the current window and 'every frame is its own window' or in other words has its own window-context
kind regards
So if I want to access the frameset rows from the current setting to "100.1.*" . The correct command would be:
parent.frameset.rows=("100.1.*")
The demo being the parent thereby replacing the word parent. Frameset being the child of the parent and so forth.
Yes, I was thinking that after I posted it. I often times think much better after I verbalize or in this case write something.
gits 5,390
Expert Mod 4TB
and in case you want a good book then have a look at this one because i personally think that this 'New Perspectives ...' book is one of the worst i ever saw - and even the reviews don't fail in this regard ... i know that you probably have to! use it ... but i think the above shown book is much!!! better ... may be you could have a look at it in a library? when you feel comfortable with it then i would recommend to buy it since there is no more complete JavaScript book out there ... just some that handle more specific topics a bit better :)
kind regards
I have to agree. This book seems to be the product of a muddled mind. I was going to say so earlier but being a student it is hard to have a full grasp. I find programming very easy because it is logical and it either works or it doesn't. You have to be very organized in your approach. This book is anything but organized. The information is not properly centalized or indexed. The projects are like fill in the blanks but you never really get a proper question and have to guess at a lot of things. It has been a real time waster for what should be an easy and fun course.
I will give this book a try. Thank you for the recommendation. I have been resorting to the internet for most of my help. I have been reluctant to purchase another resource without a proper recommendation as my money is very limited. I am working part time/full time and taking a full university curriculum to boot.
gits 5,390
Expert Mod 4TB
i see ... and therefor i would recommend to have a look at the book at a library or in a bookshop first. the web is a good place to learn and for all javascript-related things MDC is a very good reference ... it always depends on the person whether a book or other ressources are to be preferred for learning ;) ... good luck with further learning in any way. of course you could always ask for help or explaination here in the forums ;)
kind regards
Thanks again, I had not found this page in my many searches. I am sure that this will be a valuable resource.
I just downloaded firebug a couple of days ago and switched browsers because of it. I did not find this resource though. It does not surprise me though because of the excellent debugger. It already made my last project easier. However debuggers only go so far. A human resource is a much better assistance in times of need. In really large code a good debugger is a neccessity I am sure. Do you have a better one that you use for your own coding?
Back to coding;
So if I want to access the frameset rows from the current setting to "100.1.*" . The correct command would be:
parent.frameset.rows=("100.1.*")
This is from the demo page and I want to change the frameset rows from the title page.
gits 5,390
Expert Mod 4TB
you may have a look at Venkman ... this is a quite complete JavaScript-debugger ... but i use firebug too and don't need another one ;) ...
gits 5,390
Expert Mod 4TB
parent.frameset.rows=("100.1.*")
what should this do? what do you want to achieve?
In the fifth post I posted code from the demo page. I am required in the exercise to change the frameset rows parameters from
<frameset rows="100,210,*" id="demo" name="demo">
to
<frameset rows="100,1,*"> from the title page.Of course the id and name stay the same. I am using a function from the title page to achieve this. I will call the function at the time I want this command to execute. I am assuming by the code that the frameset has three frames. I am changing the frames size by this command. So to change the frames size I need to call the parent then the frameset then the rows.
parent.frameset.rows="100,1,*"
This would set the frames sizes to 100, 1, remainder of the page. Is the logic and syntax correct?
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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) {
|
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...
|
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....
|
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...
|
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...
|
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"...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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,...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |