如何使用javascript以表格格式显示数据 [英] how to display the data in table format using javascript

查看:148
本文介绍了如何使用javascript以表格格式显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用javascript以表格格式显示数据...数据是从xml文件中读取的,在下面的代码中我提到了....而不是显示消息,因为它是我需要显示相应的表格格式的字段数据。

我有六个字段,比如名字,姓氏,开放,低,高,chrg ......

帮我解决这个问题...



how to display the data in table format using javascript...data is read from the xml file and here in the below code wat i mentioned.... instead of displaying the message as it is i need to display the coresponding field data in the format of table.
I have some six fields like name,last,open,low ,high,chrg...
Help me out in doing this...

function broadcastListener(msg) {
for(int i=0;i<1000;i++)

{

  console.log("received broadcast: " + msg + ", " + msg.data[i]);

  $(<'<tr>')
  $('<td>').html(msg.data[i]).prependTo('#contentList').animate({color: "#000000"}, 6000);
  $('<tr>')
  }
  $('html, body').animate({ scrollTop: 0 }, 0);
}





google.load(jquery,1);



/ **

*回调函数 - Cometd消费者。

* /

google.setOnLoadCallback(function() {

$ .getScript(http://jquerycomet.googlecode.com/svn/trunk/jquery.comet.js,function(){

console.log (完成加载js);

$ .comet.init(http:// localhost:9099 / cometd);

$ .comet.subscribe( / broadcastMessageChannel,broadcastListener);

});



});



/ **

*收到广播消息后调用监听器功能。

* /

function broadcastListener(msg){

for(int i = 0; i< 1000; i ++)

{

console.log(收到广播:+ msg +, + msg.data [i]);

$(<'')

$('')。html(msg.data [i])。prependTo('#contentList')。animate({颜色:#000000},6000);

$('')



$('html,body')。animate ({scrollTop:0},0);

}

}



这是代码wat i有....下面提到的解决方案并没有给我带来结果... fi无法理解wat是controlid和wat vr使用它plz xplain



< br $> b $ b

谢谢你

Priyanka



google.load("jquery", "1");

/**
* Callback function - Cometd consumer.
*/
google.setOnLoadCallback(function() {
$.getScript("http://jquerycomet.googlecode.com/svn/trunk/jquery.comet.js", function(){
console.log("done loading js");
$.comet.init("http://localhost:9099/cometd");
$.comet.subscribe("/broadcastMessageChannel", broadcastListener);
});

});

/**
* Listener function called on receipt of broadcast message.
*/
function broadcastListener(msg) {
for(int i=0;i<1000;i++)
{
console.log("received broadcast: " + msg + ", " + msg.data[i]);
$(<'')
$('').html(msg.data[i]).prependTo('#contentList').animate({color: "#000000"}, 6000);
$('')

$('html, body').animate({ scrollTop: 0 }, 0);
}
}

this is the code wat i have....the below mentioned solutions are not giving outcome for me... f i could not understand wat is controlid and for wat v r using it plz xplain



Thank u
Priyanka

推荐答案

(<'< tr > ')
(<'<tr>')


('< td > ')。html(msg.data [i])。prependTo('#contentList ').animate({color:#000000},6000);
('<td>').html(msg.data[i]).prependTo('#contentList').animate({color: "#000000"}, 6000);


('< tr > ')
}
('<tr>') }


这篇关于如何使用javascript以表格格式显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆