Cd

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Separate Command Line API page for cd())
(Added parameter description and examples)
(One intermediate revision not shown)
Line 1: Line 1:
-
By default, command line expressions are relative to the top-level window of the page. This command allows you to use the window of a frame in the page instead.
+
By default, command line expressions are relative to the top-level window of the page. This command allows you to use the window of a frame in the page instead. So all expressions will be executed within the context of that frame from then on.
 +
 
 +
== Syntax ==
 +
<source lang="javascript">
 +
cd(window)
 +
</source>
 +
 
 +
== Parameters ==
 +
=== window ===
 +
Frame window to switch to. '''(required)'''
 +
 
 +
== Examples ==
 +
<source lang="javascript">
 +
cd(document.getElementById("someframe").contentWindow)
 +
</source>
 +
 
 +
Changes to the <code>window</code> of the <code>&lt;frame&gt;</code> with the id <code>someframe</code>.
 +
 
 +
<source lang="javascript">
 +
cd($$("iframe")[0].contentWindow)
 +
</source>
 +
 
 +
Changes to the <code>window</code> of the first <code>&lt;iframe&gt;</code> using the [[$$|$$ command]].
 +
 
 +
== See also ==
 +
* [[Command Line API]]

Revision as of 11:00, 13 July 2012

By default, command line expressions are relative to the top-level window of the page. This command allows you to use the window of a frame in the page instead. So all expressions will be executed within the context of that frame from then on.

Contents

Syntax

cd(window)

Parameters

window

Frame window to switch to. (required)

Examples

cd(document.getElementById("someframe").contentWindow)

Changes to the window of the <frame> with the id someframe.

cd($$("iframe")[0].contentWindow)

Changes to the window of the first <iframe> using the $$ command.

See also

Personal tools