Javascript Functions

The functions listed in this section are defined in the library javascript-lib.pl, which is included with Webmin versions 0.950 and above. These functions were generously contributed by John Smith <john.smith@mscsoftware.com>.

You can see examples of these functions in action by downloading and installing the javascript-lib.pl samples webmin module, which shows what each function does.

Table of Contents


jroll_over
This gives you simple mouse over functions on graphics and includea a link.
Parameters
&jroll_over("url", "name", "border", "imgoff", "imgon");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jroll_over("http://www.mscsoftware.com", "mscbutton", "0", "images/msc_off.gif", "images/msc_on.gif");
jimg_preload
Preloads any number of given images.
Parameters
&jimg_preload("image", "image", "image", "etc");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jimg_preload("image/1.gifi", "imgage/u.gif", "images2/button.jpg", "images2/logo.png");
jimg_update
Updates any image on your page that has a name associated with it.
Parameters
&jimg_update("name", "image");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jimg_update("mscimage", "images/new_logo.jpg");
janim
Builds an Animation with any given list of images.
Parameters
&janim("name", "speed", "image", "image", "image", "etc")
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&janim("mscanim1", "1250", "images/1.gif", "images/slide.png", "images/logofin.jpg")
janim_start
Starts the animation you built with janim.
Parameters
&janim_start("name");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&janim_start("mscanim1");
janim_stop
Stops the animation you built with janim.
Parameters
&janim_stop("name");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&janim_stop("mscanim1");
jalert
Launches an alert dialog box with a custom message.
Parameters
&jalert("message");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jalert("Your alert message!");
jwindow
Opens a window with a given URL.
Parameters
&jwindow("url", "name", "width", "height");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jwindow("http://www.msclinux.com", "msclinux", "800", "600");
jwindow_xy
Repostitions a named windows position on the users screen.
Parameters
&jwindow_xy("name", "x", "y");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jwindow_xy("msclinux", "250", "120");
jterminal
Creates an empty plain text window for writing data to.
Parameters
&jterminal("name", "width", "height");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jterminal("mscterm", "100", "300");
jwrite
Write data to a created window or terminal.
Parameters
&jwrite("name", "data");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jwrite("mscterm", "Download MSC.Linux from http://www.msclinux.com");
jtext
Simple text rollovers between two colors.
Parameters
&jtext("text", "offcolor", "oncolor");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';
&jtext("MSC.Linux Rules!", "red", "#F1F1F1");
jtalkback
Builds a JavaScript for a pop-up talkback/bug report window.
Parameters
&jtalkback();
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';

&header($text{'index_title'}, "", undef, 1, 1);

&jtalkback();

jerror
Launches the jtalkback window upon execution.
Parameters
&jerror("title", "email", "width", "height", "errmsg", "url", "erroredonline");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';

&header($text{'index_title'}, "", undef, 1, 1);

&jtalkback();

@somedata = `cat msclinux.log` or &jerror("MSC.Linux Bug Report", \
"john.smoth\@some.email.com", "400", "300", $!, $0, __LINE__);

jtalkback_link
Creates a button or text link to launch the jtalkback window.
Parameters
&jtalkback_link("title", "email", "width", "height", "text", "type");
Code Example
#!/usr/bin/perl

require '../javascript-lib.pl';

&header($text{'index_title'}, "", undef, 1, 1);

&jtalkback();

&jtalkback_link("Bug Report Window", "totheadmin\@help.desk.com", 400, 300, "Text Link", 0);
&jtalkback_link("Bug Report Window", "totheadmin\@help.desk.com", 400, 300, "Button", 1);

This Cybermirror (Imprint | DE, US & UK) is powered by Philivision (DE, US & UK).
We were provided additional Internet Consulting by Cybersulting (DE, US & UK).