Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Child Window Calls Parent Function

window.opener.ParentWindowFunction();
https://snipt.net/embed/f588fe5461dad6a1045f1e98911368b0/
https://snipt.net/raw/f588fe5461dad6a1045f1e98911368b0/
f588fe5461dad6a1045f1e98911368b0
text
Text only
1
2016-12-02T14:44:44
True
False
False
/api/public/snipt/41147/
child-window-calls-parent-function
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>window.opener.ParentWindowFunction(); </span></pre></div> </td></tr></table>
child, function, javascript, parent, window

JavaScript

Using jquery to call an iframe's parent method

1
2
3
4
// From inside an iframe
(function($) {
    parent.$("#element_in_parent").trigger("event");
} (window.jQuery));
https://snipt.net/embed/16d7d5b553b510f2d81738bb441d57d5/
https://snipt.net/raw/16d7d5b553b510f2d81738bb441d57d5/
16d7d5b553b510f2d81738bb441d57d5
js
JavaScript
6
2016-12-05T00:25:39
True
False
False
/api/public/snipt/34251/
using-jquery-to-call-an-iframes-parent-method
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// From inside an iframe</span> </span><span id="L-2"><a name="L-2"></a><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">$</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">parent</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">&quot;#element_in_parent&quot;</span><span class="p">).</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">&quot;event&quot;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">jQuery</span><span class="p">));</span> </span></pre></div> </td></tr></table>
iframe, jquery, parent

Delphi

Delphi_GetParentDirectory

1
2
3
4
5
6
7
//returns the parent directory for the
//provided "path" (file or directory)

function GetParentDirectory(path : string) : string;
begin
  result := ExpandFileName(path + '\..')
end;
https://snipt.net/embed/ba0a8a31d0ad5bce5503963ca2a75a84/
https://snipt.net/raw/ba0a8a31d0ad5bce5503963ca2a75a84/
ba0a8a31d0ad5bce5503963ca2a75a84
delphi
Delphi
7
2016-12-04T07:01:55
True
False
False
/api/public/snipt/9238/
delphi_getparentdirectory
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//returns the parent directory for the</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//provided &quot;path&quot; (file or directory)</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">function</span> <span class="nf">GetParentDirectory</span><span class="p">(</span><span class="n">path</span> <span class="o">:</span> <span class="k">string</span><span class="p">)</span> <span class="o">:</span> <span class="k">string</span><span class="o">;</span> </span><span id="L-5"><a name="L-5"></a><span class="k">begin</span> </span><span id="L-6"><a name="L-6"></a> <span class="bp">result</span> <span class="o">:=</span> <span class="nb">ExpandFileName</span><span class="p">(</span><span class="n">path</span> <span class="o">+</span> <span class="s">&#39;\..&#39;</span><span class="p">)</span> </span><span id="L-7"><a name="L-7"></a><span class="k">end</span><span class="o">;</span> </span></pre></div> </td></tr></table>
delphi, directory, file, parent
Copyrighted, illegal, or inappropriate content? Email [email protected].