Hello all,
I am trying to design a job listing page that would display all job listings, then when a user clicks on a job title it would load the corresponding description page. What I want to do is use one xml page that has the title and description like this:
that way someone from HR can go in and edit it without my help. I have the first page set up, very basic layout:
What I cant figure out is on the second html page, what do I need to code so it knows what title was clicked? I am guessing it will have to be a "if" statement, something along the lines of: "if title is clicked, display description" can anyone help me out?
Thanks!
I am trying to design a job listing page that would display all job listings, then when a user clicks on a job title it would load the corresponding description page. What I want to do is use one xml page that has the title and description like this:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<CAREERS>
<JOB>
<TITLE>Director of Sales</TITLE>
<DESC>blah blah blah</DESC>
</JOB>
<JOB>
<TITLE>Graphic Designer</TITLE>
<DESC>blah blah blah</DESC>
</JOB>
<JOB>
<TITLE>Web Developer</TITLE>
<DESC>blah blah blah</DESC>
</JOB>
</CAREERS>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
var xmlDoc=null;
if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("test.xml");
document.write("<table>");
var x=xmlDoc.getElementsByTagName("JOB");
for (i=0;i<x.length;i++)
{
document.write("<tr>");
document.write("<td>");
document.write("<a href = 'JobDesc.html'>");
document.write(
x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
document.write("</a>");
document.write("</td>");
}
document.write("</table>");
}
</script>
</body>
</html>
What I cant figure out is on the second html page, what do I need to code so it knows what title was clicked? I am guessing it will have to be a "if" statement, something along the lines of: "if title is clicked, display description" can anyone help me out?
Thanks!