Window: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
NSB/App Studio programs run within a special version of a web browser.  
NSB/AppStudio programs run within a special version of a web browser.  
As a result, they can inherit a lot of the properties of the environment they run in.  
As a result, they can inherit a lot of the properties of the environment they run in.  
You can access these properties from within your app.
You can access these properties from within your app.
Line 119: Line 119:
|-
|-
|onpageshow() || Script to run if the screen is shown. May behave differently depending on platform.
|onpageshow() || Script to run if the screen is shown. May behave differently depending on platform.
|-
|onvisibilitychange(v) || Script to run if the screen is shown or hidden. Returns True or False.
|}
|}



Revision as of 13:44, 6 September 2013

NSB/AppStudio programs run within a special version of a web browser. As a result, they can inherit a lot of the properties of the environment they run in. You can access these properties from within your app.

It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.

window object members

body The body of the window
closed Returns a Boolean value indicating whether a window has been closed or not
defaultStatus Sets or returns the default text in the statusbar of a window
devicePixelRatio The number of pixels the device has for each one the browser uses.
document Returns the Document object for the window (See Document object)
frames Returns an array of all the frames (including iframes) in the current window
history Returns the History object for the window
innerHeight Sets or returns the the inner height of a window's content area
innerWidth Sets or returns the the inner width of a window's content area
length Returns the number of frames (including iframes) in a window
location Returns the Location object for the window
name Sets or returns the name of a window
opener Returns a reference to the window that created the window
orientation Returns the current screen rotation (0,90,180,-90)
outerHeight Sets or returns the outer height of a window, including toolbars/scrollbars
outerWidth Sets or returns the outer width of a window, including toolbars/scrollbars
pageXOffset Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window
pageYOffset Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window
parent Returns the parent window of the current window
screen Returns the Screen object for the window (See Screen object)
screenLeft Returns the x coordinate of the window relative to the screen
screenTop Returns the y coordinate of the window relative to the screen
screenX Returns the x coordinate of the window relative to the screen
screenY Returns the y coordinate of the window relative to the screen
self Returns the current window
status Sets the text in the statusbar of a window
top Returns the topmost browser window
alert() Displays an alert box with a message and an OK button
blur() Removes focus from the current window
clearInterval() Clears a timer set with setInterval()
clearTimeout() Clears a timer set with setTimeout()
close() Closes the current window
confirm() Displays a dialog box with a message and an OK and a Cancel button
createPopup() Creates a pop-up window
focus() Sets focus to the current window
moveBy() Moves a window relative to its current position
moveTo() Moves a window to the specified position
open() Opens a new browser window
print() Prints the content of the current window
prompt() Displays a dialog box that prompts the visitor for input
resizeBy() Resizes the window by the specified pixels
resizeTo() Resizes the window to the specified width and height
scroll()
scrollBy() Scrolls the content by the specified number of pixels
scrollTo() Scrolls the content to the specified coordinates
setInterval() Calls a function or evaluates an expression at specified intervals (in milliseconds)
setTimeout() Calls a function or evaluates an expression after a specified number of milliseconds

window object events

ondeviceorientation() Script to run if device orientation (compass) changes
onoffline() Script to run if device loses connection to the net.
ononline() Script to run when device gets connection to the net.
onorientationchange() Script to run if the screen is rotated.
onpagehide() Script to run if the app is hidden. May behave differently depending on platform.
onpageshow() Script to run if the screen is shown. May behave differently depending on platform.
onvisibilitychange(v) Script to run if the screen is shown or hidden. Returns True or False.