Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] javascript

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Luca Passani <passani AT eunet.no>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] javascript
  • Date: Fri, 06 May 2005 13:30:25 +0200


I need to programmatically add a bit of JavaScript to an XML file, so I did:

Element script = new Element("script", "http://www.w3.org/1999/xhtml";);
String js_script = "\n function resize_all_pix() {\n";
js_script += " max_width = "+width_int+";\n";
js_script += " for(i=0;document.images.length > i;i++) {\n";
js_script += " if (max_width < document.images[i].width ) {\n";
js_script += " heigth = document.images[i].height;\n";
js_script += " new_heigth = heigth * (max_width/document.images[i].width);\n";
js_script += " document.images[i].width = max_width;\n";
js_script += " document.images[i].heigth = new_heigth;\n";
js_script += " }\n";
js_script += " }\n";
js_script += "}\n";
Text js_text = new Text(js_script);
script.appendChild(js_text);

this almonst works!

<script>
function resize_all_pix() {
max_width = 180;
for(i=0;document.images.length &gt; i;i++) {
if (max_width &lt; document.images[i].width ) {
heigth = document.images[i].height;
new_heigth = heigth * (max_width/document.images[i].width);
document.images[i].width = max_width;
document.images[i].heigth = new_heigth;
}
}
}
</script>

How do I force XOM to diplay '<' and not &lt; ?

Luca




Archive powered by MHonArc 2.6.24.

Top of Page