var result = '0,0.' + Array(decimalPlace + 1).join('0')
result = result.replace(/\.\s*$/, "");
decimalPlace 0: "0,0"decimalPlace 1: "0,0.0"
decimalPlace 2: "0,0.00"
參考:
var result = '0,0.' + Array(decimalPlace + 1).join('0')
result = result.replace(/\.\s*$/, "");
decimalPlace 0: "0,0"<input type="button" value="Import" style="positionL fixed; z-index: 10000; top: 95%; left: 5px;" onclick="$('#importFile').click()" />
<input id="importFile" type="file" style="position: fixed; z-index: 10000l top: -100px; left: -100px;" onchange="Import(this)" />
function Import(fileInput) {
var reader;
if(window.File && window.FileReader && window.FileList && window.Blob) {
reader = new FileReader();
}
else {
return;
}
var txtContent;
if(fileInput.files && fileInput.files[0]) {
reader.onload = function (e) {
txtContent = e.target.result;
console.log(txtContent);
// Custom Code
// End of Custom Code
}
reader.readAsText(fileInput.files[0]);
//Reset
fileInput.value = '';
}
}
jQuery("#list2").jqGrid('setGridParam',{data: json_History}).trigger("reloadGrid");
jQuery("#list2").jqGrid('setGridParam',{url:"server.php?q=2"}).trigger("reloadGrid");
referenceondblClickRow: function (rowid, iRow, iCol, e) {
alert("rowid: " + rowid + ", iRow: " + iRow + ", iCol: " + iCol);
if (iCol == 2) {
$(this).jqGrid("toggleSubGridRow", rowid);
}
},
onCellSelect: function (rowid, iCol, cellcontent, e) {
alert("rowid: " + rowid + ", iCol: " + iCol + ", cellcontent" + cellcontent);
if (iCol == 2) {
$(this).jqGrid("toggleSubGridRow", rowid);
}
},
$("#list").setGridParam({page:1}).trigger('reloadGrid');
$("#list").trigger("reloadGrid", [{page:1}]);
$("#list").trigger("reloadGrid", [{current:true}]);
使用無效?$('td[id$=_pager]').click(function () {
$('.buttonDownload').bind('click', Download);
});
function downloadButton(cellvalue, options, rowObject) {
return "<input type='button' class='buttonDownload' value='列印' data-formTypeId='" +@Model.formTypeId +"' data-formNumber='" + cellvalue + "' />";
}
function Download() {
var formTypeId = $(this).attr('data-formTypeId');
var formNumber = $(this).attr('data-formNumber');
}
或 ...function downloadButton(cellvalue, options, rowObject) {
return "<input type='button' class='buttonDownload' onclick='javascript:Download(" + @Model.formTypeId + ", " + cellvalue + ");' value='列印' data-formTypeId='" +@Model.formTypeId +"' data-formNumber='" + cellvalue + "' />";
}
<div id="divAddFolder" class="hideUC">
<table>
<tr>
<td>
資料夾名稱
</td>
<td>
<input id="txtNewNodeName" type="text" />
</td>
</tr>
</table>
<input id="btnAddNode" type="button" value="確定" />
<input id="btnCancelAddNode" type="button" value="取消" />
</div>
function PopupboxAdd() {
$.blockUI({
message: $('#divAddFolder'),
css: {
top: ($(window).height() - 300) / 2 + 'px',
left: ($(window).width() - 300) / 2 + 'px',
width: '300px'
}
});
}
"Hello".replace(/ll/g,"qq");
var reg = new RegExp(billNumber + ',', 'g');
$("#number").html($("#number").html().replace(reg, ''));
////合併上下欄位(colIdx)
jQuery.fn.rowspan = function(colIdx) {
return this.each(function() {
var that;
$('tr', this).each(function(row) {
var thisRow = $('td:eq(' + colIdx + '),th:eq(' + colIdx + ')', this);
if ((that != null) && ($(thisRow).html() == $(that).html())) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(thisRow).remove(); ////$(thisRow).hide();
} else {
that = thisRow;
}
that = (that == null) ? thisRow : that;
});
alert('1');
});
}
////當指定欄位(colDepend)值相同時,才合併欄位(colIdx)
jQuery.fn.rowspan = function(colIdx, colDepend) {
return this.each(function() {
var that;
var depend;
$('tr', this).each(function(row) {
var thisRow = $('td:eq(' + colIdx + '),th:eq(' + colIdx + ')', this);
var dependCol = $('td:eq(' + colDepend + '),th:eq(' + colDepend + ')', this);
if ((that != null) && (depend != null) && ($(thisRow).html() == $(that).html()) && ($(depend).html() == $(dependCol).html())) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(thisRow).remove(); ////$(thisRow).hide();
} else {
that = thisRow;
depend = dependCol;
}
that = (that == null) ? thisRow : that;
depend = (depend == null) ? dependCol : depend;
});
});
}
////合併左右欄位
jQuery.fn.colspan = function(rowIdx) {
return this.each(function() {
var that;
$('tr', this).filter(":eq(" + rowIdx + ")").each(function(row) {
$(this).find('th,td').each(function(col) {
if ((that != null) && ($(this).html() == $(that).html())) {
colspan = $(that).attr("colSpan");
if (colspan == undefined) {
$(that).attr("colSpan", 1);
colspan = $(that).attr("colSpan");
}
colspan = Number(colspan) + 1;
$(that).attr("colSpan", colspan);
$(this).remove();
} else {
that = this;
}
that = (that == null) ? this : that;
});
});
});
}
<script type="text/javascript">
$(function () {
//模擬顯示資料
var data =
[
{ No: "1", Name: "Jeffrey", Date: "2011/05/07", Score: 2011 },
{ No: "1", Name: "Jeffrey", Date: "2011/06/21", Score: 9999 },
{ No: "1", Name: "Jeffrey", Date: "2011/06/22", Score: 32767 },
{ No: "2", Name: "Mulder", Date: "2011/06/01", Score: 999 },
{ No: "3", Name: "Darkthread", Date: "2011/06/10", Score: 100 },
{ No: "3", Name: "Darkthread", Date: "2011/06/15", Score: 100 }
];
var h = [];
for (var i = 0; i < data.length; i++) {
h.push("<tr>");
var obj = data[i];
for (var p in obj)
h.push("<td class='c-" + p + "'>" + obj[p] + "</td>");
h.push("</tr>");
}
$("#scoreboard tbody").html(h.join('\n'));
//合併內容相同欄位的邏輯
$("#btnShowMe").click(function () {
var $lastCell = null;
var mergeCellSelector = ".c-No,.c-Name";
$("#scoreboard tbody td.c-No").each(function () {
//跟上列的td.c-No比較,是否相同
if ($lastCell && $lastCell.text() == $(this).text()) {
//取得上一列,將要合併欄位的rowspan + 1
$lastCell.closest("tr").children(mergeCellSelector)
.each(function () {
this.rowSpan = (this.rowSpan || 1) + 1;
});
//將本列被合併的欄位移除
$(this).closest("tr").children(mergeCellSelector).remove();
}
else //若未發生合併,以目前的欄位作為上一欄位
$lastCell = $(this);
});
});
});
</script>
<table id="scoreboard">
<thead>
<tr><td>No</td><td>Name</td><td>Date</td><td>Score</td></tr>
</thead>
<tbody>
</tbody>
</table>
void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].CssClass="SubProjectTd";
// 在每一個 row的第一個 column加上 class
}
}
$("#ddlSurvey").attr("multiple", "multiple");
$("#ddlSurvey").multiselect({...});
$("#ddlSurvey").multiselect('refresh');
result = ($(this).html()=="SubProject");
result: falseresult = ($(this).html().trim()=="SubProject");
result: true
$(function () {
$("#aspQueryString").keyup(function () {
if ($(this).attr("value").length > 100) {
}
});
});