[KDE Dot News]
 faq
 flatforty
 contribute
 subscribe
 configure
 search
 rdf

 main
 parent
 thread


Re: Javascript?
by Olivier LAHAYE on Sunday 30/Sep/2001, @04:44
javascript can use libs just like serverside javascript does, and you can include new javascript objects. You can create some objects and classes just like java.(even in html you can do that by including .js files defining classes using the <SCRIPT SRC="xxx.js"></SCRIPT> syntax)

Concerning dcop or otherthing access, it would be done the same way you access activeX objects or java applet. The extention extends the local DOM with objects and functions.

let suppose we want to load a new document called "foo.doc" in kword

then a document.open("foo.doc") would do the job.
you could also let the user choose the document with the following line:
document.menu.file.open.select();
or you could rename that menu:
document.menu.open.rename("Open a File");

Now let say you want to include a picture:
oMyPic=document.createElement("IMG")
oMyPic.src="foo.png";
document.appendChild(oMyPic);

Now, more complex thing: you want to include a speadsheet:
oMyEmbedSpreadSheet=document.createElement("EMBED");
oMyEmbedSpreadSheet.src="foo.xls";
document.appendChild(oMyEmbedSpreadSheet);

Now you want to create an empty embeded kspread object:
oMyEmptySheet=new Kspread("Sheet1","Sheet2");
oMyEmbedEmptySheet=document.createElement("EMBED");
oMyEmbedSpreadSheet.nodeValue=oMyEmptySheet;
document.appendChild(oMyEmbedEmptySheet);

Now you want to set the background of the 1st cell of the first sheet to red:
oMyEmptySheet.sheet[0].cells[0][0].style.background="red";

As you see, oMySpreadSheet would just behave as a standard html object with datas and methods.

Note that you could also have acces to a DCOP object and its methods and variables in the same way. (although, the purpose of a scripting language is maily to automatize things that can often be do by hand. I think it would be a bad idea to write plugins with it (even if possible). Just look at msword or other scriptable programs. Scripts are only used to automatize the behaviour of the document. I've never seen a vbscript that extends M$ Word behaviour)

By that way, exporting thoses pages to the net INCLUDING scripting would be less difficult.

Javascript also include security concepts.

that was just my 2 cents.

PS: don't try to think in terms of netscrape 4.x javascript, its DOM is so poor that of cours almost nothing complex is possible and most of its usage is reserved to string computation and document.write().
  Related Links
 ·   Articles on Developer
 ·   Also by Olivier LAHAYE
 ·   Contact author

Thread Threshold:

The Fine Print: The following comments are owned by whomever posted them.
( Reply )

  "If you have an itch not being scratched, you can scratch it, or pay someone to scratch it for you." -- Eric Laffoon
KDE®, "K Desktop Environment", "KDE Dot News", "got the dot?" and the KDE Logo® are trademarks or registered trademarks of KDE e.V. in the European Union, the United States and other countries. All other trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the poster. The rest: Copyright © 2000-2008 KDE e.V. for The KDE Project. For further information or comments on this site, please contact the Webmaster.
[ home | post article | flat forty | subscribe | search | rdf ]