Hello, I am trying to style some html through a javascript loop which outputs the html through the document.write(); function. My CSS styles seem to come through correctly, however my sifr classes are not calling my flash file for some reason. I was thinking it might have something to do with the javascript document.write function I am using.
Id like to know if it is possible to use SIFR in this way. If not, does anyone have any alternatives to what Im doing?
Here is my code: (basically, I am loading data from an XML file and outputting it as HTML with document.write - I have bolded the piece of code that I am reffering to. I am a designer who trys to write javascript, so keep that in mind before tearing apart my function. =)
document.write("<h1 class="h1_sifr_green">Tours in the <br />");
document.write(search_term.toUpperCase());
document.write(" area:</h1><br /><br />");
Again, my h1 tag comes through fine, as well as all my other css classes EXCEPT my sifr class. Thanks in advance, any help here is appreciated.
Here is my code in it's entirety:
<html>
<head>
<link href="../css/colors.css" rel="stylesheet" type="text/css" />
<link href="../css/layout.css" rel="stylesheet" type="text/css" />
<link href="../css/textstyles.css" rel="stylesheet" type="text/css" />
<link href="../css/sifr.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/sifr.js"></script>
<script type="text/javascript" src="js/sifr-config.js"></script>
<script type="text/javascript">
function parseXML()
{
var search_term=window.location.search.substring(1); //sets the search_term variable to the URL string query
var tour_name;
var tour_link;
var tour_logo;
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e)
{
alert(e.message);
return;
}
}
xmlDoc.async=false;
xmlDoc.load(search_term + ".xml");
x=xmlDoc.documentElement.childNodes;
document.write("<h1 class=\"h1_sifr_green\">Tours in the <br />");
document.write(search_term.toUpperCase());
document.write(" area:</h1><br /><br />");
for (i=0;i<x.length;i++)
{
tour_name=xmlDoc.getElementsByTagName("name")[i].firstChild.nodeValue;
tour_link=xmlDoc.getElementsByTagName("tourlink")[i].firstChild.nodeValue;
document.write("<a href=\"" + tour_link + "\" class=\"b3 textlink\">" + tour_name + "</a>");
document.write("<br />");
}
}
</script>
</head>
<body>
<div id="wrap" style="background-image:url(../images/index_06.jpg); width:550px">
<div style="padding:30px">
<script type="text/javascript" language="JavaScript">
parseXML();
</script>
</div>
</div>
</body>
</html>