parent

Call parent Javascript function from inside an iframe

旧城冷巷雨未停 提交于 2019-11-27 10:30:15
问题 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? 回答1: Try just parent.myfunction() . Also be 100% sure that the parent.js is

Import from sibling directory

徘徊边缘 提交于 2019-11-27 07:05:41
I have a Python class called "ClassA" and another Python class which is supposed to import ClassA which is "ClassB". The directory structure is as follows: MainDir ../Dir ..../DirA/ClassA ..../DirB/ClassB How would I use sys.path so that ClassB can use ClassA? You really should be using packages. Then MainDir is placed at a point in the file system on sys.path (e.g. .../site-packages), then you can say in ClassB: from MainDir.Dir.DirA import ClassA # which is actually a module You just have to place files named __init__.py in each directory to make it a package hierarchy. as a literal answer

Refreshing Parent window after closing popup

一笑奈何 提交于 2019-11-27 06:46:32
问题 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,

PHP - Find parent key of array

安稳与你 提交于 2019-11-27 05:28:22
I'm trying to find a way to return the value of an array's parent key. For example, from the array below I'd like to find out the parent's key where $array['id'] == "0002". The parent key is obvious because it's defined here (it would be 'products'), but normally it'd be dynamic, hence the problem. The 'id' and value of 'id' is known though. [0] => Array ( [data] => [id] => 0000 [name] => Swirl [categories] => Array ( [0] => Array ( [id] => 0001 [name] => Whirl [products] => Array ( [0] => Array ( [id] => 0002 [filename] => 1.jpg ) [1] => Array ( [id] => 0003 [filename] => 2.jpg ) ) ) ) ) A

How to get windows batch's parent folder

会有一股神秘感。 提交于 2019-11-27 04:41:11
问题 I'm writing a batch file, I need to get the parent folder of this bat file. Is it possibile? NB I mean the parent folder of the batch file not of the current directory of the prompt calling that batch. Thanks 回答1: The parent folder of a Batch is in the Variable %~dp0 located. Example: @echo off&setlocal for %%i in ("%~dp0.") do set "folder=%%~fi" echo %folder% 来源: https://stackoverflow.com/questions/16623780/how-to-get-windows-batchs-parent-folder

Getting a parent element for a jquery selector

风格不统一 提交于 2019-11-27 03:50:00
问题 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

How do I Scroll parent page to top when child page is click within iframe?

混江龙づ霸主 提交于 2019-11-27 01:14:36
问题 When someone clicks on a link within an iframe (child page), how do I get the parent page to scroll to the top? The issue is the child page will remain in the same spot of the page, because the iframe has a lot of height larger than the parent page. Please note: the parent and child pages are on different sub domains. I created a demo to show this: http://www.apus.edu/_test/iframe/index.htm 回答1: The trick is to append the following onload="window.parent.parent.scrollTo(0,0)" to the iframe and

Win32 window Owner vs window Parent?

混江龙づ霸主 提交于 2019-11-27 00:40:38
问题 In Win32 programming, what is the difference between a window's parent and a window's owner? I thought I had it figured out, then I came across this code: SetWindowLong(handle, GWL_HWNDPARENT, foo); This actually sets the window's owner, not the parent - despite the GWL_HWNDPARENT being used. Are the terms parent/owner interchangeable, or is there actually a difference? 回答1: Owner is the Window* responsible for a control or dialog (for example, responsible for creating/destroying the window).

Changing the child element's CSS when the parent is hovered

我们两清 提交于 2019-11-26 22:19:37
问题 First of all, I'm assuming this is too complex for CSS3, but if there's a solution in there somewhere, I'd love to go with that instead. The HTML is pretty straightforward. <div class="parent"> <div class="child"> Text Block 1 </div> </div> <div class="parent"> <div class="child"> Text Block 2 </div> </div> The child div is set to display:none; by default, but then changes to display:block; when the mouse is hovered over the parent div. The problem is that this markup appears in several

How to override a LESS mixin variable based on a parent's variable

大兔子大兔子 提交于 2019-11-26 22:11:17
问题 I am a newbie, so be gentle. I am sure my terminology is incorrect too: suppose I have my own jumbotron override: .jumbotron { background-color: #ff4400; } and then I want to have a custom override of that where I inherit the above class and only override its background color using its color as a parameter to "lighten()". I can't figure out the syntax: .Myjumbotron { .jumbotron; /* not sure what goes below for "parent.background-color" */ background-color: lighten(parent.background-color, 30%