parent

jQuery select descendants, including the parent

有些话、适合烂在心里 提交于 2019-11-29 09:06:25
Consider the following HTML: <div class="foo" id="obj"> I should be changed red <div class="bar" style="color:black;"> I should not be changed red. <div class="foo">I should be changed red.</div> </div> </div> Given a DOM element obj and an expression, how do I go about selecting any children and possibly obj ? I'm looking for something similar to "select descendants" but also including the parent, if it matches the expression. var obj = $("#obj")[0]; //wrong, may include siblings of 'obj' $(".foo", $(obj).parent()).css("color", "red"); //wrong -- excludes 'obj' $(".foo", obj).css("color",

Forwarding child control MouseMove events to the parent seamlessly

☆樱花仙子☆ 提交于 2019-11-29 08:42:22
I have a custom UserControl that I am drawing using the GDI+. It is a transparent control which draws small shapes on top of the parent control. All the parent window does is creates the control, gives it a Rectangle in which to draw itself, and then it receives events if the user clicks on the non-transparent areas. The drawing part works perfectly, but right now what I need to do is to as seamlessly as possible forward all MouseMove, MouseClick, etc. events to the parent control IF those events occurred outside the shapes. The shapes are drawn using GraphicsPath, and I am already able to

get href attribute of enclosing link tag

两盒软妹~` 提交于 2019-11-29 08:04:12
Having a little trouble on this one. I need a way using Jquery/JS to find the HREF attribute of the enclosing link tag: <a href="something.html"><img src="img1.jpg" class="active"></a> I want to target the img by class and find the value of the 1st preceding href attribute. $("img.active").somethingAwesome().attr("href"); Please show me somethingAwesome() ...help? $("img.active").parent("a").attr("href") will get the direct parent's href attribute, assuming it's an anchor. If there's any depth of containing blocks between the image and the anchor, use instead $("img.active").closest("a").attr(

How do I call PHP parent methods from within an inherited method?

时间秒杀一切 提交于 2019-11-29 07:49:01
In PHP, I'm trying to reference a method defined in an object's parent class, from a method inherited from the object's parent class. Here's the code: class base_class { function do_something() { print "base_class::do_something()\n"; } function inherit_this() { parent::do_something(); } } class middle_class extends base_class { function do_something() { print "middle_class::do_something()\n"; } } class top_class extends middle_class { function do_something() { print "top_class::do_something()\n"; $this->inherit_this(); } } $obj = new top_class; $obj->do_something(); The problem is that parent:

Checking the status of a child process in C++

主宰稳场 提交于 2019-11-29 07:17:23
问题 I have a program that uses fork() to create a child process. I have seen various examples that use wait() to wait for the child process to end before closing, but I am wondering what I can do to simply check if the file process is still running. I basically have an infinite loop and I want to do something like: if(child process has ended) break; How could I go about doing this? 回答1: Use waitpid() with the WNOHANG option. int status; pid_t result = waitpid(ChildPID, &status, WNOHANG); if

How to find nth parent of an element using jquery

拥有回忆 提交于 2019-11-28 20:50:46
问题 I want to find the nth parent element of an given element and access the attributes of parent. <div id='parent1'><br/> <div id='parent2'><br/> <span><p id='element1'>Test</p></span><br/> </div><br/> <div id='parent3'><br/> <span><p id='element2'>Test</p></span><br/> </div><br/> </div> I want to access the 3rd parent element of element1 without using $('#element1').parent().parent().parent() Any help would be appreciated 回答1: You can use .parents() and .eq() : $('#element1').parents().eq(2);

JS iframe父子页面元素调用方法 | window parent top opener 解释

痴心易碎 提交于 2019-11-28 20:20:20
iframe 父窗口调用子窗口 var hasMore = parent.document.getElementByIdx_x_x_x("hasMore").value; 子窗口调用父窗口 document.frames["ifrmBoxFrame"].me.preLoadBoxGrid(); window.frames["iframe_ID"].document.getElementByIdx_x_x_x("iframe_document_object"-).object_attribute = attribute_value; window 是对当前窗口自身的引用 如: window.returnValue = ret; window.close(); top 返回顶层窗口,即浏览器窗口。 如: top.frames[tabID].location = url; top.document.frames("ifrmBoxFrame").me.executeQueryCond(); parent 返回父窗口 如: parent.$("Insheet_FrameTable").src = ""; parent.frames["Insheet_FrameSheetList"].initInsheetList(false); opener opener用于在window

How to access to the parent object in c#

混江龙づ霸主 提交于 2019-11-28 20:14:41
I have a "meter" class. One property of "meter" is another class called "production". I need to access to a property of meter class (power rating) from production class by reference . The powerRating is not known at the instantiation of Meter. How can I do that ? Thanks in advance public class Meter { private int _powerRating = 0; private Production _production; public Meter() { _production = new Production(); } } Store a reference to the meter instance as a member in Production: public class Production { //The other members, properties etc... private Meter m; Production(Meter m) { this.m = m;

jQuery select element in parent window

我怕爱的太早我们不能终老 提交于 2019-11-28 20:03:43
Is there a way to select a DIV in the parent window using jQuery? For example: Main page contains this, <div id="testdiv"></div> Popup page has a form with some options and an 'Apply' button. When the user clicks apply it affects the style attribute on the main page. Something along the logic of, parent.$("#testdiv").attr("style", content from form); Use the context-parameter $("#testdiv",parent.document) But if you really use a popup, you need to access opener instead of parent $("#testdiv",opener.document) TARKUS I looked for a solution to this problem, and came across the present page. I

Change Parent url from iframe

。_饼干妹妹 提交于 2019-11-28 19:06:58
Need help with a simple problem! which has the following criteria: 1) click on images link in iframe changes Parent page, click on another iframe image link changes Parent to another page (see below). It may sound simple but I'm being googled it for days now and looked over many forums. Code can be in html css or js, but please keep any answers simple as possible and post a full working example to work as I'm new to coding or recode the test site: http://www.howiepotter.com/parent.html http://reference.sitepoint.com/html/a/target "_top" loads content in the top-level frameset (in effect, the