Some display adjustments, make keys actually work in modern browsers
[slides.git] / fosdem2003 / l10ntalk_05.html
CommitLineData
3288eeda 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
5 <meta name="Author" content="KaiRo - Robert Kaiser">
6 <title>L10n talk - FOSDEM 2003 - Mozilla Meeting</title>
7 <link rel="stylesheet" type="text/css" href="l10ntalk.css">
8 <link rel="contents" href="index.html" title="Contents">
9 <link rel="index" href="l10ntalk_overview.html" title="Overview">
10 <link rel="start" href="index.html" title="Start">
11 <link rel="first" href="l10ntalk_01.html" title="First page">
12 <link rel="previous" href="l10ntalk_04.html" title="Previous page">
13 <link rel="next" href="l10ntalk_06.html" title="Next page">
14 <link rel="last" href="l10ntalk_12.html" title="Last page">
15</head>
16<body>
17
18<h1>using JavaScript to display text</h1>
19
20<div class="explanation">
21Sometimes we have to display text dynamically in the UI though, which XUL alone can't do.
22Most times JavaScript is used for that. C++ is sometimes used as well, it uses a similar technique for
23displaying localized content though, and it uses the same type of files for localization.
24</div>
25
26<div class="sample">
27<p class="sampledesc">Sample XUL: openLocation.xul, calling some JS code</p>
28<div class="samplecontent">
29&lt;?xml version=&quot;1.0&quot;?&gt;
30<br>&lt;!DOCTYPE dialog SYSTEM &quot;chrome://communicator/locale/openLocation.dtd&quot;&gt;
31<br>&lt;dialog id=&quot;openLocation&quot; ... title=&quot;&amp;caption.label;&quot; <b>onLoad=&quot;onLoad();&quot;</b>&gt;
32<br>&lt;script type=&quot;application/x-javascript&quot; src=&quot;chrome://communicator/<b>content/openLocation.js</b>&quot;/&gt;
33<br>...
34<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;menuitem value=&quot;0&quot; id=&quot;currentWindow&quot; label=&quot;&amp;topWindow.label;&quot;/&gt;
35<br>...
36<br>&lt;/dialog&gt;
37</div>
38</div>
39
40<div class="sample">
41<p class="sampledesc">Sample JavaScript: openLocation.js</p>
42<div class="samplecontent">
43...
44<br>function onLoad()
45<br>{
46<br>&nbsp;&nbsp;dialog.main = document.getElementById("openLocation");
47<br>&nbsp;&nbsp;dialog.openTopWindow = document.getElementById("currentWindow");
48<br>&nbsp;&nbsp;if (!browser) {
49<br>&nbsp;&nbsp;&nbsp;&nbsp;// No browser supplied - we are calling from Composer
50<br>&nbsp;&nbsp;&nbsp;&nbsp;// Change string to make more sense for Composer
51<br>&nbsp;&nbsp;&nbsp;&nbsp;dialog.openTopWindow.setAttribute("label", "<span class="hilite">Existing Navigator window</span>");
52<br>&nbsp;&nbsp;&nbsp;&nbsp;// change title to 'Open Location with Mozilla'
53<br>&nbsp;&nbsp;&nbsp;&nbsp;dialog.open.setAttribute("title", "<span class="hilite">Open Location with Mozilla</span>");
54<br>&nbsp;&nbsp;}
55<br>}
56</div>
57</div>
58
59</body>
60</html>