/    Sign up×
Community /Pin to ProfileBookmark

creating a basic job listing page using javascript and xml

Hello all
I have a newb question for you experts, I want to create a job listing page that has a list of job titles available. All the job listings will be hyperlinked to the same html page. When a user clicks on the job title they want to look at a new window comes up with the job description. What I am trying to do is create two pages, one has the job titles and the other has the job description based on what job title they have clicked on. Here is my xml

[code=php]<?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]

And here is my html (javascript)

[code=html]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<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>
[/code]

so I guess I am wonder what I need to put on that second page that will know what description to display?
thanks!

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @bmiles spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...