Get Opener Element From A Child
Jul 23, 2005
How do I get the contents of an element in the opener and show them in the
child?
What I'm trying to do is something like this:
In the opener: <h1 id="pgtitle">Office XP</h1>
In the child:
function gt_pageCont () {
var pagetitle = window.opener.document.getElementById("pgtitle");
var pagetext = "<h1>""+title+""</h1><p>Here are some more info about ""
+title+ "".</p>";
document.write(pagetext);
}
and:
<body onload="gt_pageCont();">
I know that something is missing in the function, because I've tested it and
the child displays [Object] instead of "Office XP".
View 5 Replies
ADVERTISEMENT
Jul 23, 2005
I have a parent window that pushes a new window object onto an Array
with the following code :
OpenChild()
{
//totalNumWindowsCreated is global
totalNumWindowsCreated = totalNumWindowsCreated + 1;
childWnds.push(window.open(link, "child" +
totalNumWindowsCreated,"dependent"));
..
..
..
}
This pops up a new window with every call. In the child window I call
a parent function onbeforeunload, appClose() :
function appClose(){
if (window.opener && !window.opener.closed){
window.opener.CloseChild(getQueryString("application"));
}}
This is in my frameset tag of the child code :
<frameset ... onbeforeUnload='appClose()'>
The window.opener.CloseChild() function is called perfectly when I have
one child window open, but as soon as I create another child window
both of the open child windows don't ever call it. They do both go
into the onbeforeunload appClose() function, but do not call the
window.opener.CloseChild() function inside of this routine.
Anyone have any ideas why when I have two child windows open I can't
access the window.opener functions?
I have tried taking each new window out of the array and used the
following code in CloseChild() :
CloseChild()
{
//win and totalNumWindowsCreated are both global
totalNumWindowsCreated = totalNumWindowsCreated + 1;
var win = window.open(link, "child" +
totalNumWindowsCreated,"dependent");
..
..
..
}
View 1 Replies
View Related
Jul 23, 2005
Is there a way to monitor a newly opepend child window with opener,
even when the page keeps reloading ?
Say window A opens window B and gives it a name/handle "myWindow".
At this point anywhere in window A, we could say
myWindow.location.href to find out where the child is.
But what if someone was to take window A to another site, and than
return using history button, OR reload it completely.
upon load the var myWindow would get executed again, and it seems like
the handle would be lost. I tried to see if there was a
window.children collection that might still hold window B in its
subset, but was not able to find a way thus far.
View 1 Replies
View Related
Oct 4, 2010
i have a menu generated by a list with nested lists. i want the parent link to stay highlighted when the mouse hovers over the sub menus. because those sub menus are also generated by jquery (qtip), CSS alone won't do it (triedul.topnav li:hover a {background-color: #F00;}).is there a way to do this using jquery?
View 15 Replies
View Related
Mar 16, 2010
The bit of code in bold in the code below is giving me this error in IE: Error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; Tablet PC 2.0; InfoPath.2; OfficeLiveConnector.1.4; .NET CLR 3.0.30729; OfficeLivePatch.1.3; MSN OptimizedIE8;ENGB)Timestamp: Tue, 16 Mar 2010 15:07:11 UTC Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
[Code]....
View 1 Replies
View Related
Aug 26, 2010
I have a javascript here for adding my div element to my registration form,Adding the div element is easy, but it shows on the bottom of my form. I cant make it as the first child element of my form...This is my code
var _form = document.getElementById('registration_form');
var errorDiv = document.createElement('div');
errorDiv.setAttribute('class', 'confBox');
[code]....
View 2 Replies
View Related
Jul 14, 2006
I see how the window.opener works, pretty neat in that the pop window
knows the parent.
Is there a property that also knows the form field parent?
My function does not know which of the 3 select menus called it.
What can I do?
function onCarrierSelect() {
//
var frm = document.carrRequestForm.carrierList.selectedIndex
var selectCar =
document.carrRequestForm.carrierList.options[frm].text;
alert(selectCar);
if (window.opener && !window.opener.close)
window.opener.document.form(x how make global?).nbcarrier(x how make
global?).value = selectCar
window.close();
}
p.s. as an aside I know the form field name, it is literally in the
querystring, but that is ASP/vbscript and no way to get it into the
jscript function...
View 4 Replies
View Related
Apr 24, 2009
I've got a reference to a TableCell and I'd like to use jQuery to get the first instance of an <IMG> tag within that TableCell, but can't get the syntax right, I understand how it would work if I were to reference the TableCell by and ID or class, but not when I have a direct reference to the cell, I've got:
What the jQuery syntax should be to get the first img tag within "tdRef"?
View 2 Replies
View Related
Jun 30, 2009
I have a function which looks like
function mainLeftElements(){
var containerDiv = document.getElementById('mainLeft');
var elems = containerDiv.childNodes;
alert(elems.length);
}
Which for a div declared like so:
<div id = 'mainLeft'></div>
Alerts me it has a length of 1, trying to work out what the element is (thinking it might be a blank text element or something, maybe the id attribute also??) by using
elems[0].tagName
and
elems[0].id
I get confused as they both return 'undefined', so what is it?
View 2 Replies
View Related
Jun 12, 2009
My example markup as follows
I want to collect all the child elements inside this two fieldset elements through looping.
View 3 Replies
View Related
Jun 30, 2009
I have a problem with my javascript.
I have a function which looks like
which for a div declared like so
alerts me it has a length of 1, trying to work out what the element is (thinking it might be a blank text element or something, maybe the id attribute also??) by using
and
i get confused as they both return 'undefined', so what is it?
View 2 Replies
View Related
Aug 27, 2010
I have a div, id is 'pages'. Inside 'pages' is a dynamic amount of divs id = 'posts' each followed by another div id='date_area'
Example:
HTML Code:
<div id='pages'>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
... etc
</div>
I need a way to select BOTH the first occurrence of <div class='posts'></div> and the LAST occurrence of <div class='posts'></div>. Then I need to set different css rules for both of them. In CSS, I can use first-child, but this doesn't work in older browsers. CSS last-child does not work here because it targets date_area and also doesn't work in older browsers.
View 6 Replies
View Related
Apr 4, 2011
I'm using the following code that adds to <a> tags to each <td> inside a table.
$(document).ready(function() {
$('.calendar td:not(.notinmonth.)').each(function() {
$(this).append('<a href="#" class="available am">AM: Available</a>').append('<a href="#" class="available pm">PM: Available</a>');
});
$('.calendar td:not(.notinmonth.)').each(function() {
$(this).has('.event').remove('.am');
});
});
The second half of the code looks to see if any of the cells contain an element with class 'event'. If one exists, then the '.am' anchor should be removed. However this does not appear to be happening. After carrying out a few tests with the 'alert' function, it looks as though the script thinks that every cell contains a '.event' element, but I have no idea why! Not only that, it doesn't remove the '.am' link from any of them.
Here is the markup for the table (the cell with 'Day 9' in it is the only one that should match having an '.event' element:
<table class="calendar"><thead>
<tr><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th>
<th class="weekend">Sat</th><th class="weekend">Sun</th></tr>
</thead><tbody>
<tr><td class="notinmonth"></td><td class="notinmonth"> .....
View 2 Replies
View Related
May 26, 2009
Simple stuff here
My HTML is like this:
<div class="feature">
<h2>Heading Goes Here</h2>
<img src="photo.jpg" />
[Code]....
What I want to happen is for the element inside the .feature class to appear when the <h2> of that <div> is clicked I tried using next() and a few other methods but it doesn't work as neatly as I want it to - how can I tell jQuery to just return the element within that div (and not all elements which are inside a .feature class)?
View 2 Replies
View Related
Sep 2, 2009
I've 2 field sets and a div inside each fieldset with some contents. When the legend of the current fieldset is clicked, I will toggle the div contents. I'm trying to write a generic function which can be used by everyone. Here is my design:
<fieldset id="fs1">
<legend id="leg1">First Legend</legend>
<div id="div1">
[code]....
View 10 Replies
View Related
Jul 2, 2009
I have the usual unordered list for a navigation menu with submenus...
html:
<ul>
<li><a href="#">Link 1</a></li>
<li>
[code].....
All of the links inside of the parent <li> have a border radius. But if the parent <li> has a child <ul>, I don't want the link to have a radius.I'm currently using this jQuery:
<script>
$("li").has("ul").addClass("sub-radius");
</script>
It works fine except it's targeting the <li>, but I need it to target the child <a> and remove its radius.
View 1 Replies
View Related
Oct 5, 2009
I was wondering if there was any way I can give a child element, preferably the first one, a link through a parent element with an ID. code...
View 6 Replies
View Related
Aug 12, 2009
suppose I have the following:
Code HTML4Strict:
<li id="lists">
<a> ... </a>
<li>
[code]....
here it now selects all a tag in "lists" but I only want it to reference the a tag that is the direct child of "lists" li. I want it to ignore the freen highlighted part.
<li id="lists"><a> ... </a><li><a> ... </a>
<a> ... </a>
<a> ... </a></li>
</li>
View 2 Replies
View Related
Feb 2, 2011
I have been scratching my head on this one for a couple days:
Code:
function hideAll(){
var education = document.getElementById("education").childNodes;
[Code]....
As far as I know, this should be working the way I expect it to (set the display of all the childnodes to none), but I guess I'm missing something. Is it not possible to instantiate a variable using childNodes without choosing a specific index of the array? I just assumed it would work like any other array
View 7 Replies
View Related
Jul 30, 2010
please see the code below.at the moment, when you click img, click eventtriggeredbecause parent element has click event.I want click event not to be triggered when you click img.How would I do that?
$("#click1").click(function(){
alert('Clicked.');
});
[code]....
View 2 Replies
View Related
Sep 30, 2011
i am working with opacity. i dont want to include child tr with the table element opacity.
View 1 Replies
View Related
Feb 2, 2010
I'm trying to add a click listener to a list element that has a hidden unordered list.
<script type="text/javascript">
$(function(){
$('li:has(ul)').click(function(event)
{
[Code]....
Basically, I'm looking for a way to find a list element that has a ul child, and then hide or show that ul. What I have here doesn't seem to be working.
View 2 Replies
View Related
Jul 29, 2009
How can I pick an id element (here #bridge1,#bridge2) and toggle its child (here a p element) without actually using the id element as parent?
'this > p' apparently does not work.
$('#bridge1,#bridge2').click(function(){
$('this > p').toggle();
return false;
});
View 3 Replies
View Related
Oct 22, 2010
I was wondering if there is a "selector construct" that matches an element having more than one child. So I'm looking for a solution that doesn't need
an if statement such as;
if($('ul').children().size()>1)
{
//do this
}
[Code]....
But I'm looking for a selector that already looks for these conditions. Kind of like how :has() works but then a check for more than one child.
View 2 Replies
View Related
Mar 27, 2011
I have a pop up div that i want to close onmouseout. but it keeps closing when it rolls over a child element.
View 1 Replies
View Related
Aug 3, 2009
I have a small problem with a page I'm working on. I have an anchor tag inside a table that has a mouseover event that updates a contextual help box. I need to add a similar mouseover event to the anchor tag that does the same thing, but updates the help box with different text. The problem I have is that when the mouse is over the table, no matter if I move the mouse over the anchor, the help text only displays the message that is passed from the table's mouseover function call. I think the solution *may* be something to do with event bubbling, but I'm not exactly sure how to implement it. The code I'm dealing with is below:
[Code]...
View 1 Replies
View Related