# Interessante post su come Mozilla XUL in esecuzione all'interno di Internet Explorer di Jean-Yves Cronier

<datetime class="hidden">2005-10-30T00:00</datetime>

<!-- category -- mostlylucidcouk, Imported -->
## 

Interessante post su come Mozilla XUL in esecuzione all'interno di Internet Explorer di Jean-Yves Cronier

pubblicato il Domenica, 12 settembre 2004 11:46

Lasciate che il crossover continui! Jean-Yves Cronier a sinistra [un commento](/archive/2003/11/23/648.aspx) sul mio [vecchio post su HTC all'interno di Mozilla](/archive/2003/11/23/648.aspx), indica un posto che ha lasciato nel [Forum XULPlanet](http://xulplanet.com/forum/viewtopic.php?t=1038) mostrando una tecnica per ottenere [Comportamenti XUL](http://xulplanet.com/tutorials/whyxul.html) esecuzione all'interno di Internet Explorer utilizzando un semplice comportamento HTC come una sorta di livello di interfaccia. Questo è di nuovo, piuttosto cool - e sarebbe ancora più fresco se potrebbe essere esteso per consentire la traduzione completa tra tutti i comportamenti IE HTC e il loro equivalente XUL! Comunque, dal momento che questo è pubblicato su un forum non so nulla di abot, ripeterò il post qui:

Ho riflettuto sulle possibilità offerte dal comportamento famoso HTC sotto IE. Penso che sarebbe forse possibile interpretare una piccola parte delle specifiche di XUL.

Un piccolo campione:

index.xul:

| <!----> |
| --- |
| **Codice:** |
| &lt;?xml version="1.0" encoding="iso-8859-1"?&gt; <br>&lt;?xml-stylesheet type="text/css" href="xul.css" media="all"?&gt; <br>&lt;window id="example-window" title="Example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt; <br>&lt;label control="some-text" value="Inserisci un po' di testo"/&gt; <br>&lt;textbox id="some-text" value="toto"/&gt; <br>&lt;label control="some-password" value="Inserisci una password"/&gt; <br>&lt;casella di testo id="some-password" type="password" maxlength="8"/&gt; <br>&lt;etichetta menulista "Bus"&gt; <br>  &lt;menupopupCity name (optional, probably does not need a translation)&gt; <br>    &lt;menuitem label="Car"/&gt; <br>    &lt;menuitem label="Taxi"/&gt; <br>    &lt;menuitem label="Bus" select="true"/&gt; <br>    &lt;menuitem label="Train"/&gt; <br>  &lt;/menupop&gt; <br>&lt;/menulist&gt; <br>&lt;/finestra&gt; |

xul.css:

| <!----> |
| --- |
| **Codice:** |
| label{comportamento:url(label.htc)} <br>menuitem{comportamento:url(menuitem.htc)} <br>menulista{comportamento:url(menulist.htc)} <br>menupopup{comportamento:url(menupop.htc)} <br>textbox{comportamento:url(textbox.htc)} <br>window{comportamento:url(window.htc)} |

label.htc:

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="value" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build(){this.innerHTML=this.value;} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

menuitem.htc:

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="id" /&gt; <br>&lt;public:property name="label" /&gt; <br>&lt;public:property name="value" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build() { <br> var option = document.createElement("option"); <br> var style=this.currentStyle; <br> option.setAttribute("id,"id); <br> if(this.id!=null){option.setAttribute("id,"this.id);} <br> if(this.value!=null){option.setAttribute("value,"this.value);} <br> if(label!=null){option.innerHTML=label;} <br> for(var prop in style){option.style[prop]=stile[prop];} <br> this.outerHTML=option.outerHTML; <br>} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

menulist.htc:

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="id" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build() { <br> var select = document.createElement("select"); <br> var style=this.currentStyle; <br> select.setAttribute("id,"id); <br> if(id!=null){ <br> select.setAttribute("id,"this.id); <br> select.setAttribute("name,"this.id); <br>   } <br> select.innerHTML=this.innerHTML; <br> for(var prop in style){ <br> select.style[prop]=stile[prop]; <br>   } <br> select.style.width="100%"; <br> this.outerHTML=select.outerHTML; <br>} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

menupopup.htc:

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="id" /&gt; <br>&lt;public:property name="label" /&gt; <br>&lt;public:property name="value" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build() { <br> var optgroup = document.createElement("optgroup"); <br> var style=this.currentStyle; <br> if(this.id!=null){optgroup.setAttributo("id,"this.id);} <br> if(this.label!=null){optgroup.innerHTML=this.label;} <br> optgroup.innerHTML=this.innerHTML; <br> for(var prop in style){optgroup.style[prop]=stile[prop];} <br> this.outerHTML=optgroup.outerHTML; <br>} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

textbox.htc :

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="id" /&gt; <br>&lt;public:property name="value" /&gt; <br>&lt;public:property name="type" /&gt; <br>&lt;public:property name="maxlength" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build() { <br> var input = document.createElement("input"); <br> var style=this.currentStyle; <br> input.setAttributo("id,"id); <br> if(value!=null){input.setAttributo("value,"value);} <br> if(type!=null){input.setAttributo("type," type);} <br> if(maxlength!=null){input.setAttributo("maxlength,"maxlength);} <br> for(var prop in style){input.style[prop]=stile[prop];} <br> input.style.width="100%"; <br> input.style.cursor="text"; <br> input.style.borderStyle="inset"; <br> input.style.borderColor="ActiveBorder"; <br> input.style.borderWidth="2px"; <br> input.style.backgroundColor="#FFFFFF"; <br> input.style.paddingleft="2px"; <br> Questo.outerHTML=input.outerHTML; <br>} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

window.htc:

| <!----> |
| --- |
| **Codice:** |
| &lt;pubblico:htc urn="window"&gt; <br>&lt;public:attach event="ondocumentready" handler="build" /&gt; <br>&lt;public:property name="title" /&gt; <br>&lt;script type="text/javascript"&gt; <br>function build(){window.status=this.title;} <br>&lt;/script&gt; <br>&lt;/public:htc&gt; |

E' divertente, vero? ![Molto felice](http://xulplanet.com/forum/images/smiles/icon_biggrin.gif)

L'obiettivo di un progetto come questo non è quello di aumentare Internet Explorer, ma solo di mostrare una piccola panoramica ad altri (che non hanno Mozilla Web Browser) le tecnologie disponibili con Mozilla Framework