INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Problems with script - any help ?  (Read 1566 times)

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Problems with script - any help ?
« on: June 19, 2014, 04:52:19 am »

Hi all,
i have the following HTML code

<tr>
      <td>
      <!-- begin: loop(z, 0, [PlayingNowFileCount] - 1) -->
         
         
         <tr>
         <script type="text/javascript">
               Load_Tag_info('[PlayingNowFile([z]).FileKey]');
         </script>
         <td>[PlayingNowFile([z]).FileKey]</td>
                         <td>
         <div id="Info.Name"></div>
         </td>
         </tr>
      
       <!-- end: loop -->
      </td>
      </tr>

The script that is called is :

function Load_Tag_info(filekey) {
 $.get( "MCWS/v1/File/GetInfo?File=" + filekey +"&Action=MPL", function( data ) {
  var xml = $.parseXML(data);
         alert(filekey);
 

 
      // get all items
      var items = xml.getElementsByTagName("Field");

      if (items != null) {

         // loop items
         for (var i = 0; i < items.length; i++) {

            // parse values
            var name = items.getAttribute("Name");
            var value = items.childNodes[0].nodeValue;
            
            // get corresponding element

            var element = document.getElementById("Info." + name);
            if (element != null) {

               // update element
               if ((element.src != null) && (element.src != "")) {
                  if (element.src != value)
                     element.src = value; // image
               }
               else {
                  if (element.innerHTML != value)
                     element.innerHTML = value; // text
               }
            }
         }
      }

});
}

Both script and html seem to be working fine however the part <div id="Info.Name"></div> always stays at the same position, and thus overwriting the previous loop results.

any idea's ?  in my opinion i am overlooking something but i can not find it

raf
Logged
Pages: [1]   Go Up