Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:42:45+00:00 2026-05-28T01:42:45+00:00

I’m trying to get my a tags to display the name from a xml

  • 0

I’m trying to get my a tags to display the name from a xml file, I currently have the link changing color and text when it is triggered, but I would like it to get its original state name from a xml file.

I am only interested in the Input links here.

Here is the html side of things:

<div id="status">
    <div id="loading" style="display:none">Error:<br />Connection to EMACSYS board was lost.</div>
    <div id="display">
        <p></span></p>
        <p>Inputs:<br /><span style="font-size:20pt"></p>
        <a id="btn0">&bull; Input 1</a><br>
        <a id="btn1">&bull; Input 2</a><br>
        <a id="btn2">&bull; Input 3</a><br>
        <a id="btn3">&bull; Input 4</a><br>
        <a id="btn4">&bull; Input 5</a><br>
        <a id="btn5">&bull; Input 6</a><br>
        <a id="btn6">&bull; Input 7</a><br>
        <a id="btn7">&bull; Input 8</a><br>
        <a id="btn8">&bull; Input 9</a><br>
        <a id="btn9">&bull; Input 10</a><br>
        <a id="btn10">&bull; Input 11</a><br>
        <a id="btn11">&bull; Input 12</a><br>
        <a id="btn12">&bull; Input 13</a><br>
        <a id="btn13">&bull; Input 14</a><br>
        <a id="btn14">&bull; Input 15</a><br>
        <a id="btn15">&bull; Input 16</a><br>
        </span> </p>
        <p>Canopy Temperature: <a id="analogue0">?</a>
        <br /><span style="font-size:20pt">
        <a id="pot0">&rsaquo;</a>
        <a id="pot1">&rsaquo;</a>
        <a id="pot2">&rsaquo;</a>
        <a id="pot3">&rsaquo;</a>
        <a id="pot4">&rsaquo;</a>
        <a id="pot5">&rsaquo;</a>
        <a id="pot6">&rsaquo;</a>
        <a id="pot7">&rsaquo;</a>
        <a id="pot8">&rsaquo;</a>
        <a id="pot9">&rsaquo;</a>
        </span></p>
        <p>Engine Heater Temperature: <a id="analogue1">?</a> (30-90 normal)
        <br /><span style="font-size:20pt">
        <a id="1pot0">&rsaquo;</a>
        <a id="1pot1">&rsaquo;</a>
        <a id="1pot2">&rsaquo;</a>
        <a id="1pot3">&rsaquo;</a>
        <a id="1pot4">&rsaquo;</a>
        <a id="1pot5">&rsaquo;</a>
        <a id="1pot6">&rsaquo;</a>
        <a id="1pot7">&rsaquo;</a>
        <a id="1pot8">&rsaquo;</a>
        <a id="1pot9">&rsaquo;</a>
        </span></p>

    </div>

Which all seems ok and works fine when an input is triggered, but where it says Input 1, Input 2, etc. i would like it to load from this xml file the inputname tags

<response>
<input0>~Inputs(1)~</input0>
<inputname0>Mains OK</inputname0>
<input1>~Inputs(2)~</input1>
<inputname1>Water Heater</inputname1>
<input2>~Inputs(3)~</input2>
<inputname2>Genset Standby</inputname2>
<input3>~Inputs(4)~</input3>
<inputname3>Genset Running</inputname3>
<input4>~Inputs(5)~</input4>
<inputname4>Common Alarm</inputname4>
<input5>~Inputs(6)~</input5>
<inputname5>Genset Shutdown Alarm</inputname5>
<input6>~Inputs(7)~</input6>
<inputname6>Genset Fuel Tank 1/2</inputname6>
<input7>~Inputs(8)~</input7>
<inputname7>Genset Fuel Tank 1/4</inputname7>
<input8>~Inputs(9)~</input8>
<inputname8>Genset Fuel Tank Low</inputname8>
<input9>~Inputs(10)~</input9>
<inputname9>option</inputname9>
<input10>~Inputs(11)~</input10>
<inputname10>option</inputname10>
<input11>~Inputs(12)~</input11>
<inputname11>Bulk Fuel Full</inputname11>
<input12>~Inputs(13)~</input12>
<inputname12>Bulk Fuel 3/4</inputname12>
<input13>~Inputs(14)~</input13>
<inputname13>Bulk Fuel 1/2</inputname13>
<input14>~Inputs(15)~</input14>
<inputname14>Bulk Fuel 1/4</inputname14>
<input15>~Inputs(16)~</input15>
<inputname15>Bulk Fuel Low</inputname15>
<output0>~Outputs(1)~</output0>
<output1>~Outputs(2)~</output1>
<output2>~Outputs(3)~</output2>
<output3>~Outputs(4)~</output3>
<output4>~Outputs(5)~</output4>
<output5>~Outputs(6)~</output5>
<output6>~Outputs(7)~</output6>
<output7>~Outputs(8)~</output7>
<output8>~Outputs(9)~</output8>
<output9>~Outputs(10)~</output9>
<output10>~Outputs(11)~</output10>
<output11>~Outputs(12)~</output11>
<output12>~Outputs(13)~</output12>
<output13>~Outputs(14)~</output13>
<output14>~Outputs(15)~</output14>
<output15>~Outputs(16)~</output15>
<analogue0>~Analogs(1,T,2,3977)~</analogue0>
<analogue1>~Analogs(2)~</analogue1>
<analogue2>~Analogs(3)~</analogue2>
<analogue3>~Analogs(4)~</analogue3>
<analogue4>~Analogs(5)~</analogue4>
<analogue5>~Analogs(6)~</analogue5>
<analogue6>~Analogs(7)~</analogue6>
<analogue7>~Analogs(8)~</analogue7>
</response>

So for Input 1 it would show Mains OK, then when it was triggered it would show Alert, then back to Mains OK when it was back to normal.

I’ve tried a few things in the javascript:

<script type="text/javascript">
// Parses the xmlResponse from status.xml and updates the status box
function updateStatus(xmlData) {
    // Check if a timeout occurred
    if(!xmlData)
    {
        document.getElementById('display').style.display = 'none';
        document.getElementById('loading').style.display = 'inline';
        return;
    }

    // Make sure we're displaying the status display
    document.getElementById('loading').style.display = 'none';
    document.getElementById('display').style.display = 'inline';

    // Loop over all the LEDs
    for(i = 0; i < 16; i++) {
        if(getXMLValue(xmlData, 'input'+i) == '1') {
            document.getElementById('btn' + i).style.color = '#d00';
            document.getElementById('btn' + i).innerHTML = '&bull; ALERT';
            }
        else {
            document.getElementById('btn' + i).style.color = '#090';
            document.getElementById('btn' + i).innerHTML = ('&bull; )getXMLValue(xmlData, 'inputname'+i);
        }
    }

    // Loop over all the buttons

    // Update the POT value
    document.getElementById('analogue0').innerHTML =getXMLValue(xmlData,'analogue0');
    val=0;
    for(i = 0; i < 10; i++) {
    val=val+10;
    if(getXMLValue(xmlData, 'analogue0') >val)
        document.getElementById('pot' + i).style.color = '#090';
    else
        document.getElementById('pot' + i).style.color = '#fff';
    }

    // Update the POT value 2
    document.getElementById('analogue1').innerHTML =getXMLValue(xmlData,'analogue1');
    val=0;
    for(i = 0; i < 10; i++) {
    val=val+10;
    if(getXMLValue(xmlData, 'analogue1') >val)
        document.getElementById('1pot' + i).style.color = '#090';
    else
        document.getElementById('1pot' + i).style.color = '#fff';
    }


}
setTimeout("newAJAXCommand('status.xml', updateStatus, true)",500);
</script>

but not to any luck. I am pretty sure its to do with the javascript part of it because this is my weakest area.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:42:46+00:00Added an answer on May 28, 2026 at 1:42 am

    I believe that you have a syntax error on the following line of code:

    document.getElementById('btn' + i).innerHTML = ('&bull; )getXMLValue(xmlData, 'inputname'+i);

    On the right-hand side of the equals sign, you have an unterminated string: '&bull;...

    I’m not certain of exactly what you’re trying to do, but I’m guessing that you want to have a bullet point, followed by the result of getXMLValue(xmlData, 'inputname'+1)

    I would suggest that you try replacing this line with the following:
    document.getElementById('btn' + i).innerHTML = '&bull;' + getXMLValue(xmlData, 'inputname'+i);

    Please let me know how this works for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.