2012-3-12
今天工作中遇到的問題總結:
一,javascript中把字符串轉為數字的函數是什么?
parseInt(str)
parseFloat(str)
二,Ajax的Post請求:
??????? function DisplayIcons(page_index) {
??????????? var page_size;
??????????? page_size = 250;
??????????? $.ajax({
??????????????? type: 'POST',
??????????????? url: "/Normal/Service.aspx?Module=IconsReader&Action=GetResult",
??????????????? data: { "pageIndex": page_index, "pageSize": page_size },
??????????????? dataType: "json",?? //數據自動成Json數據了,否則item.Folder is undefined
??????????????? success: function (json) {
??????????????????? var iconlist = json;
??????????????????? var result;
??????????????????? var pre;
??????????????????? result = "<table id=\"MenuImage\">";
??????????????????? result = result + "<tbody>" + "<tr>";
??????????????????? $.each(json, function (i, item) {
??????????????????????? //console.log(i);
??????????????????????? if ((i - 1) % 10 == 0) {
??????????????????????????? result = result + "<tr>";
??????????????????????? }
??????????????????????? result = result + "<td>";
??????????????????????? result = result + "<input name=\"MenuImage\" id=\"MenuImage_" + i + "\" type=\"radio\" value=\"" + item.Name + "\"/>";
??????????????????????? result = result + "<label for=\"MenuImage_" + i + "\">";
??????????????????????? result = result + "<img height=\"16\" src=\"" + item.Folder.Path + item.Name + "\" complete=\"complete\" weight=\"16\"/>";
??????????????????????? //console.log(item.Name);
??????????????????? });
??????????????????? //$("#icon_panel").html(JSON.parse(json).1.Index);
??????????????????? $("#icon_panel").html(result);
??????????????? }
??????????? });
??????? }
轉載于:https://www.cnblogs.com/szjdw/archive/2012/03/12/2392331.html
總結
- 上一篇: auto register volati
- 下一篇: 用js实现分享到随页面滚动而滑动效果