我有一个javascript函数,我嵌入了html。我有一个变量,我试图调用toString方法。但是,我的页面不喜欢我的思路。这就是我所拥有的:
function (item) {
'<h3>' + item.StartDate.ToString("MM/dd/yyyy") + '</h3>'
}
答案 0 :(得分:2)
我认为它可能看起来像:
function printMyItem(item) {
return '<h3>' + item.StartDate.toString("MM/dd/yyyy") + '</h3>';
}
document.write(printMyItem());
语法也是toString
而不是ToString
。
那样的东西?
答案 1 :(得分:1)
您的报价很好,但toString
不是ToString
。