Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Display a javascript object in html table?
Old 07-31-2007, 11:07 PM Display a javascript object in html table?
Junior Talker

Posts: 2
Name: Olkainfri
Trades: 0
I am trying to understand DOM scripting, so how would you do to display the testlink object content in a two column table? one column for the first three atributes ine one cell and the last one in a second cell?

Code:
 
      // Example Objet en json

      var TestlinkJson = {"id_source":"7315f47dba65515fca60c851d7065bc6","url_source":"http:\/\/news.yahoo.com\/s\/afp\/20060822\/od_afp\/chinacateringcultureoffbeat_060822074830","title_source":"Jail-theme teahouse becomes prisoner of own success in China - Yahoo! News","smartlinks_infos":[{"id_dest":"75effc69e8c68b389c65c67119463312","score":"126","deleted":"0","date":"1164279208","zone_cible":"151","manually_added":"0","url_dest":"http:\/\/news.yahoo.com\/s\/afp\/20060825\/od_afp\/malaysiahealthtoilets_060825160532","title_dest":"Malaysia calls for \"toilet revolution\" - Yahoo! News"}]}

      //fonction de construction de SmartLinks

      // notice we're now using JSON as the init data

      function TestLink(json_init)
      {
 
          // init data is used from the init object, e.g. json_init.property
 
          this.url_source = json_init.url_source; //l'url du document source du SmartLinks
 
          this.title_source = json_init.title_source; // titre du doc source du SmartLinks
 
          this.id_source = json_init.id_source; //l'id de la source du SmartLinks
 
          // notice Array() -- you need to use the proper constructor
 
          // to actually create an array
 
          this.smartlinks_info = new Array(); //tableau de liens cible avec info sur la zone, la date etc...
 
      }
   
 
      // note I changed the name of the instance var to avoid confusion
 
      var testLinkInstance = new TestLink(TestlinkJson);
 
      // this will alert saying '[Object]' or something similar,
 
      // since you are attempting to alert with an entire object
 
      alert(testLinkInstance);
kreel-ex is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Display a javascript object in html table?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.07509 seconds with 12 queries