我有一个 HTML 输入框设置为 type=date
<input name="datereceived" type="date" class="FormDateValues" id="datereceived" />
Run Code Online (Sandbox Code Playgroud)
我想在文档加载到今天的日期时使用 Jquery 填充此输入框,但因为我在澳大利亚,我必须使用 GMT+10 进行偏移
为了获得日期,我执行以下操作:
var newDate = new Date();
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用以下方法设置输入框:
$('#datereceived').val(newDate.toLocaleDateString());
Run Code Online (Sandbox Code Playgroud)
浏览器告诉我,对于 type=date,格式必须设置为 yyyy-MM-dd 而不是 dd/MM/yyyy 的澳大利亚时间格式。
我不确定如何执行 toLocaleDateString 并将日期转换为 yyyy-MM-dd。
我有一个用Ajax创建的数据表.但是,我不希望显示所有字段,因此我在不太重要的字段上将bVisible设置为false.
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "../DataQueries/FetchAllSubjectsForBrowse.asp",
"aoColumns": [
/* Subject Name */ null,
/* Address */ null,
/* LinkedWithCompany */ { "bVisible": false},
/* Work Tel */ null
]
} );
Run Code Online (Sandbox Code Playgroud)
但是,我希望能够单击一行来检索所有值,包括隐藏的值.所以我尝试了以下内容:
$('#example tbody tr').live('click', function () {
var sTitle;
var nTds = $('td', this);
var sSubjectName = $(nTds[0]).text();
var sSubjectAddress = $(nTds[1]).text();
var sLinkedWithCompany = $(nTds[2]).text();
var sWorkTel = $(nTds[3]).text();
});
Run Code Online (Sandbox Code Playgroud)
但是,当我检索sLinkedWithCompany的值时,它会给我sWorkTel的值.
我对如何检索这个隐藏值感到有点困惑.
谢谢
我在JOptionPane.showConfirmDialog中有一个JPanel.我想将是/否/取消按钮更改为自定义值但不确定如何.
private void displayGUI(String msg) {
UIManager.put("OptionPane.okButtonText", "SNOOZE");
final int selectedVal = JOptionPane.showConfirmDialog(null, getPanel(msg));
if (selectedVal == JOptionPane.OK_OPTION){
System.out.println("Ok button has been pressed.");
}
}
private JPanel getPanel(String msg) {
JPanel panel = new JPanel();
JLabel label = new JLabel (msg, JLabel.CENTER);
label.setFont (label.getFont ().deriveFont (32.0f));
panel.setPreferredSize(new Dimension(500,500));
panel.add(label);
return panel;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用UIManager,但没有成功.
jquery ×2
datatables ×1
date ×1
datetime ×1
java ×1
javascript ×1
joptionpane ×1
jpanel ×1
swing ×1