HTML_Javascript
[ class tree: HTML_Javascript ] [ index: HTML_Javascript ] [ all elements ]

Class: HTML_Javascript

Source Location: /HTML_Javascript-1.1.2/Javascript.php

Class Overview


Main Javascript class


Methods


Inherited Variables

Inherited Methods


Class Details

[line 112]
Main Javascript class

Provides the basic function to output Javascript scripts, like start and end tags or set the output mode.



[ Top ]


Method Detail

alert   [line 391]

mixed alert( string $str, [boolean $var = false])

A wrapper for alert
  • Return: PEAR_Error if no script was started or the processed string
  • Access: public

Parameters:

string   $str   —  the string to output
boolean   $var   —  set to true if $str is a variable name

[ Top ]

confirm   [line 414]

string confirm( string $str, string $assign, [bool $var = false])

Create a box with yes and no buttons.

In futur releases, the 1st arg will change, $str will always be the 1st argument, $assign the 2nd.

  • Return: the processed string

Parameters:

string   $assign   —  the JS variable to assign the confirmation box to
string   $str   —  the string that will appear in the confirmation box
bool   $var   —  whether $str is a JS var or not

[ Top ]

endScript   [line 265]

mixed endScript( )

Used to end the script (</script>)
  • Return: PEAR_Error if no script has been started or the end tag for the script
  • Access: public

[ Top ]

getOutputMode   [line 177]

mixed getOutputMode( )

Get the output mode for the script

[ Top ]

popup   [line 477]

mixed popup( string $assign, string $file, string $title, int $width, int $height, mixed $attr, [int $top = 300], [int $left = 300])

A method for easy generation of popup windows
  • Return: PEAR_Error on error or the processed string.

Parameters:

string   $assign   —  the JS var to assign the window to
string   $file   —  the file that will appear in the new window
string   $title   —  the title of the new window
int   $width   —  the width of the window
int   $height   —  the height of the window
mixed   $attr   —  an array containing the attributes for the new window, each cell can contain either the ints 1/0 or the strings 'yes'/'no'. The order of attributes: resizable, scrollbars, menubar, toolbar, status, location. Can be also a boolean, and then all the attributes are set to yes or no, according to the boolean value.
int   $top   —  the distance from the top, in pixels (only used if attr=false|true).
int   $left   —  the distance from the left, in pixels (only used if attr=false|true).

[ Top ]

popupWrite   [line 523]

the popupWrite( string $assign, string $str, string $title, int $width, int $height, mixed $attr, [int $top = 300], [int $left = 300])

Creates a new popup window containing a string. Inside the popup windows you can access the opener window with the opener var.

Parameters:

string   $assign   —  the JS variable to assign the window to
string   $str   —  the string that will appear in the new window (HTML tags would be parsed by the browser, of course)
string   $title   —  the title of the window
int   $width   —  the width of the window
int   $height   —  the height of the window
mixed   $attr   —  see popup()
int   $top   —  distance from the top (in pixels
int   $left   —  distance from the left (in pixels)

[ Top ]

prompt   [line 439]

mixed prompt( string $str, string $assign, [string $default = ''], [string $var = false])

Open a propmt (input box)
  • Return: PEAR_Error or the processed string

Parameters:

string   $str   —  the string that will appear in the prompt
string   $assign   —  the JS var that the input will be assigned to
string   $default   —  the default value
string   $var   —  wether $str is a JS var or not

[ Top ]

setOutputMode   [line 154]

mixed setOutputMode( [integer $mode = HTML_JAVASCRIPT_OUTPUT_RETURN], [string $file = NULL])

Set the output mode for the script

Parameters:

integer   $mode   —  the chosen output mode, can be either HTML_JAVASCRIPT_OUTPUT_RETURN, HTML_JAVASCRIPT_OUTPUT_ECHO or HTML_JAVASCRIPT_OUTPUT_FILE
string   $file   —  the path to the file (if $mode is HTML_JAVASCRIPT_OUTPUT_FILE)

[ Top ]

startScript   [line 246]

mixed startScript( [bool $defer = true])

Starts a new script
  • Return: a PEAR_Error if a script has been already started or a string (HTML tag <script>)
  • Access: public

Parameters:

bool   $defer   —  whether to wait for the whole page to load before starting the script or no. Use defer only with script that does not change the document (i.e. alert does not change it).

[ Top ]

write   [line 335]

mixed write( string $str, [boolean $var = false])

A wrapper for document.writeln
  • Return: PEAR_Error if no script was started or the processed string
  • Access: public

Parameters:

string   $str   —  the string to output
boolean   $var   —  set to true if $str is a variable name

[ Top ]

writeLine   [line 363]

mixed writeLine( string $str, [boolean $var = false])

A wrapper for document.writeln with an addtional
tag
  • Return: PEAR_Error if no script was started * or the processed string
  • Access: public

Parameters:

string   $str   —  the string to output
boolean   $var   —  set to true if $str is a variable name

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:34:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.