parent

Call parent Javascript function from inside an iframe

拟墨画扇 提交于 2019-11-28 17:28:53
I have a iframe (in my domain), that iframe has a file iframe.js . My parent document has a file parent.js . I need to call a function that is in parent.js , from a function that is in iframe.js . I tried doing window.parent.myfunction() this function is in the parent.js file. But, it didn't work. Only when I put the function on the parent page (I mean in the HTML), then it worked. Any idea how to get this to work? Try just parent.myfunction() . Also be 100% sure that the parent.js is included in your parent document. I know this is an old question, but in case the accepted answer doesn't work

How to call a parent method from child class in javascript?

醉酒当歌 提交于 2019-11-28 15:40:58
I've spent the last couple of hours trying to find a solution to my problem but it seems to be hopeless. Basically I need to know how to call a parent method from a child class. All the stuff that I've tried so far ends up in either not working or over-writing the parent method. I am using the following code to set up OOP in javascript: // SET UP OOP // surrogate constructor (empty function) function surrogateCtor() {} function extend(base, sub) { // copy the prototype from the base to setup inheritance surrogateCtor.prototype = base.prototype; sub.prototype = new surrogateCtor(); sub

How do I get the n-th level parent of an element in jQuery?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 15:14:08
When I want to get, for example, the 3rd level parent of the element I must write $('#element').parent().parent().parent() Is there a more optimal method for this? Since parents() returns the ancestor elements ordered from the closest to the outer ones, you can chain it into eq() : $('#element').parents().eq(0); // "Father". $('#element').parents().eq(2); // "Great-grandfather". Depends on your needs, if you know what parent your looking for you can use the .parents() selector. E.G: http://jsfiddle.net/HenryGarle/Kyp5g/2/ <div id="One"> <div id="Two"> <div id="Three"> <div id="Four"> </div> <

Refreshing Parent window after closing popup

与世无争的帅哥 提交于 2019-11-28 12:09:05
I am creating a popup window that goes to hello.html. I want my original (parent page) to reload when i close the popup window (hello.html). I can't seem to get it to work, but I'm close. Here is the code I have so far for the main page and the hello.html page.... <!DOCTYPE html> <html> <head> <script type="text/javascript"> function open_win() { window.open("hello.html","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); } </script> <script language="JavaScript"> function refreshParent() { window

jQuery multiple parent() calls

浪子不回头ぞ 提交于 2019-11-28 11:27:46
I have this jQuery: $(this).parent().parent().find(".license_tooltip").stop(true, true).fadeIn(200); The $(this) object is nested within two div s like this: <div> <div> <a href="">$(this) object</a> </div> <div> <a href="">object to fade in</a> </div> </div> Can someone point me in the right direction to making my jQuery more streamlined? The structure presented above is replicated multiple times, so using classes and IDs is impossible. You can use a class (or any other selectable attribute) and .closest() to claim to the parent you want, like this: <div class="container"> <div> <a href="">$

Getting a parent element for a jquery selector

一个人想着一个人 提交于 2019-11-28 10:38:43
I have a table where each row has a CSS id like this: <table> <tr id='1'>...</tr> <tr id='2'>...</tr> <tr id='3'>...</tr> </table> In a row, a user can click on a particular element within a cell. I want to find the row that has been clicked on. So for example: <tr id='x'><td></td>...<td><div class='someclass'><div class='anotherclass'></div></div></td>...</tr> In this case, I want to respond when the user clicks on a class='anotherclass' element. I want to get the id of the row containing this clicked element but I don't want to use $(this).parent().parent().parent().... etc. because there

Get index of parent div from child divs

假装没事ソ 提交于 2019-11-28 08:04:44
问题 I have a few divs and inside them I have nested divs. I would like to be able to get the index of the parent div my child divs reside in. Ie: If I clicked "post5" I would get the index1 or If I clicked "post4" it would still get index 1. Html: <div class="more-content"> <div class="post">post 1</div> <div class="post">post 2</div> <div class="post">post 3</div> </div> <div class="more-content"> <div class="post">post 4</div> <div class="post">post 5</div> <div class="post">post 6</div> </div>

Is there a way to access parent modules in Python

强颜欢笑 提交于 2019-11-28 07:35:27
问题 I need to know if there is a way to access parent modules from submodules. If I import submodule: from subprocess import types I have types - is there some Python magic to get access to subprocess module from types ? Something similar to this for classes ().__class__.__bases__[0].__subclasses__() . 回答1: If you've accessed a module you can typically get to it from the sys.modules dictionary. Python doesn't keep "parent pointers" with names, particularly because the relationship is not one-to

Php - get parent-script name

北城余情 提交于 2019-11-28 07:04:43
问题 parent.php: require_once 'child.php'; child.php: echo __FILE__; It will show '.../child.php' How can i get '.../parent.php' 回答1: print $_SERVER["SCRIPT_FILENAME"]; 回答2: The chosen answer only works in environments that set server variables and specifically won’t work from a CLI script. Furthermore, it doesn't determine the parent, but only the topmost script file. You can do almost the same thing from a CLI script by looking at $argv[0], but that doesn’t provide the full path. The environment

How to access and change value of parent window control from child window in C#

懵懂的女人 提交于 2019-11-28 07:04:25
问题 Hi how can I change text value of text box in parent window from child window.. i.e I have parent window have textbox1 and button and child window has textbox2 and button. I need to update the value of textbox1 when I enter some text in child window's textbox2. i did some simple function to do this logically its correct but its not working I have no idea why.. parent.cs namespace digdog { public partial class parent : Form { public parent() { InitializeComponent(); } public void changeText