简体   繁体   中英

Is it possible to get content of an XML element using Javascript to populate site content?

My HTML has this currently hard-coded to read the status of the website and has a colored bar image attached to the CSS attribute that goes behind the status text.

     <tr>           

        <td id="normal_status" color="green"><b>NORMAL</b></td>

     </tr>

Is there a way I can have it instead of be hard-coded with color="green" and <b>NORMAL</b> and instead read from the XML file for those values?

Why not just use stylesheets? http://www.w3schools.com/xsl/

Most browsers will render the XML correctly to (X)HTML when there's a stylesheet processing instruction attached.

You could use spry to load the content from a xml to a html page

http://www.adobe.com/devnet/dreamweaver/articles/spry_creating_xml_data_set.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM