我有一个包含一些动态生成数据的表.问题是我想选择所有<td>'s具有数字(格式化或非格式化)数据类型的数据并为它们应用一些样式.我最好能用jQuery或JavaScript做到这一点吗?任何帮助或建议将不胜感激.谢谢.
<table>
<tr>
<th>Days</th>
<th>Booth 1</th>
<th>Booth 2</th>
<th>Booth 3</th>
</tr>
<tr>
<td>Monday</td>
<td>12,000</td>
<td>2,500</td>
<td>0</td>
</tr>
<tr>
<td>Tuesday</td>
<td>4,200</td>
<td>0</td>
<td>3,500</td>
</tr>
<tr>
<td>Wednesday</td>
<td>Out Of Order</td>
<td>Busy</td>
<td>11,540</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud) 例如.
var myObject = {
'item_123': {
'id': 1,
'name': 'Some name'
},
'item_789': {
'id': 2,
'name': 'Another name'
}
};
Run Code Online (Sandbox Code Playgroud)
item属性/对象的数字部分之前是未知的,因为它们是唯一ID并且是自动生成的.是否有可能从myObject获取项目计数而不通过它循环?
我是新玩框架(1.2.4),我正在努力设置cookie.我已经阅读了1.2.4 api doc,但找不到出错的地方.cookie没有设置,而是应用程序使用这样的cookie值执行GET请求:index?name=user&value=123&duration=1d并且页面变为空白.render()没有被召唤.我在application.conf中缺少设置吗?以下是我的代码.
public static void setCookie(String name, String value, String duration) {
// Setting cookie
System.out.println(">> Setting Cookie :" + name);
response.setCookie(name, Crypto.sign(value), duration);
}
public static Http.Cookie getCookie(String key) {
// retrieving cookie by key
return Http.Response.current().cookies.get(key);
}
Run Code Online (Sandbox Code Playgroud)
这是我调用setCookie的地方
public static void index() {
// some code.
setCookie("user", "123", "1d");
render();
}
Run Code Online (Sandbox Code Playgroud)