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"> |
21 | Sometimes we have to display text dynamically in the UI though, which XUL alone can't do. |
22 | Most times JavaScript is used for that. C++ is sometimes used as well, it uses a similar technique for |
23 | displaying 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 | <?xml version="1.0"?> |
30 | <br><!DOCTYPE dialog SYSTEM "chrome://communicator/locale/openLocation.dtd"> |
31 | <br><dialog id="openLocation" ... title="&caption.label;" <b>onLoad="onLoad();"</b>> |
32 | <br><script type="application/x-javascript" src="chrome://communicator/<b>content/openLocation.js</b>"/> |
33 | <br>... |
34 | <br> <menuitem value="0" id="currentWindow" label="&topWindow.label;"/> |
35 | <br>... |
36 | <br></dialog> |
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> dialog.main = document.getElementById("openLocation"); |
47 | <br> dialog.openTopWindow = document.getElementById("currentWindow"); |
48 | <br> if (!browser) { |
49 | <br> // No browser supplied - we are calling from Composer |
50 | <br> // Change string to make more sense for Composer |
51 | <br> dialog.openTopWindow.setAttribute("label", "<span class="hilite">Existing Navigator window</span>"); |
52 | <br> // change title to 'Open Location with Mozilla' |
53 | <br> dialog.open.setAttribute("title", "<span class="hilite">Open Location with Mozilla</span>"); |
54 | <br> } |
55 | <br>} |
56 | </div> |
57 | </div> |
58 | |
59 | </body> |
60 | </html> |