dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Very newb, probably really easy question

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    62

    Very newb, probably really easy question

    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:
    PHP 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>
    that way someone from HR can go in and edit it without my help. I have the first page set up, very basic layout:
    PHP Code:
    <!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
    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[i] is clicked, display description[i]" can anyone help me out?
    Thanks!

  2. #2
    Member
    Join Date
    Aug 2004
    Location
    UK
    Posts
    88
    is this a flash problem?
    http://robotnic.co.uk/
    -----------------------------------------

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    62
    no this is xml and javascript. I thought maybe somebody would be able to help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center