function textbox() {
var ctl = document.getElementById('tt');
- Apr 24 Fri 2015 11:41
javascript input插入文字至游標位置
- Apr 23 Thu 2015 16:35
Templete參考
- Apr 23 Thu 2015 11:49
置頂靠右DIV
<div style="background-color:deeppink;height:100%;width:300px;position:absolute;z-index:1000;float:right;right:0px;"><img src="img/logo.png" /></div>
- Apr 23 Thu 2015 11:49
jQuery dataTable 排序 搜尋
$('#dataTables-example').dataTable({ order: [[0, 'desc']] }); $('#dataTables-example').dataTable() .columnFilter({ aoColumnDefs: [{ "bSortable": false, "aTargets": [0] }], sPlaceHolder: "head:before", aoColumns: [{ type: "select" }, { type: "text" }, { type: "select" }, { type: "select" }, { type: "select" }, null ] });
- Apr 23 Thu 2015 10:34
T-SQL WHILE
DECLARE @_i INT DECLARE @_MAX INT SET @_i = 0 SET @_MAX = 10 -- 要產生幾筆資料 WHILE (@_i<@_MAX) BEGIN --要迴圈的語法 INSERT INTO #TT VALUES('T') --加1 Set @_i=@_i+1 END
- Apr 22 Wed 2015 18:27
jQuery 捲軸跑到最上面
$(window).scroll(function () { if ($(this).scrollTop() > 300) { $('#goTop').fadeIn("fast"); } else { $('#goTop').stop().fadeOut("fast"); } });
- Apr 22 Wed 2015 18:26
javascript 按Enter送出
$(document).keypress(function (e) { if (e.keyCode == 13) { $("#<%=btn_搜尋.ClientID%>").trigger('click'); } })
- Apr 22 Wed 2015 18:25
jQuery 圖片隨視窗自動調整大小
//先儲存圖片原始大小,之後調整不可以原始大小大 var UML_img_width = []; var 說明_img_width = []; $(window).load(function () { var i = 0; $('.UML img').hide(); $('.說明 img').hide(); $('.UML img').each(function () { UML_img_width.push($(this).width()); if ($(this).width() > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } i++; }) $('.說明 img').each(function () { 說明_img_width.push($(this).width()); if ($(this).width() > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } i++; }) $('.UML img').show(); $('.說明 img').show(); }) //圖片自動調整大小 $(window).resize(function () { console.log('UML_heading:' + $('.UML_heading').width()); //alert($('.UML_heading').width()); var i = 0; $('.UML img').hide(); $('.說明 img').hide(); $('.UML img').each(function () { //alert($(this).width() + ':' + img_width[i]); if (UML_img_width[i] > $('.UML_heading').width()) { //alert(img_width[i]); $(this).width($('.UML_heading').width() - 10); } $(this).show(); i++; }) i = 0; $('.說明 img').each(function () { if (說明_img_width[i] > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } $(this).show(); i++; }) })
- Apr 22 Wed 2015 17:42
jQuery selector class child each
$selector2 = $('ul.topnav').each(function(){ alert($(this).children().length);});
- Apr 22 Wed 2015 14:32
T-SQL 查詢預存
ALTER PROCEDURE [dbo].[一般搜尋EX] @函式名稱 NVARCHAR(255) = '' ,@程式語言 NVARCHAR(255) = '' ,@起始行 INT = 0 ,@結束行 INT = 0 AS BEGIN SET NOCOUNT ON ; DECLARE @語法 NVARCHAR(MAX) = '' ,@語法2 NVARCHAR(MAX) = '' ,@條件 NVARCHAR(1024) = '' ,@參數 NVARCHAR(1024) = '' ,@顯示欄位 NVARCHAR(512) = '' SET @顯示欄位 =N'SELECT *' SET @語法 = N' FROM (SELECT ROW_NUMBER() OVER (ORDER BY 內文流水號 DESC) ROWID,X2.*,X1.目錄名稱,X3.程式語言 FROM [目錄](NOLOCK) X1 LEFT JOIN [內文](NOLOCK) X2 ON X1.目錄流水號=X2.來源目錄 LEFT JOIN [程式語言](NOLOCK) X3 ON X2.程式語言id = X3.id WHERE (1=1){0} ) A {1}'; SET @語法2 = @語法; SET @語法 = @顯示欄位 + @語法; IF @函式名稱 <> '' SET @條件 += N' OR (X2.函式名稱 LIKE ''%'+@函式名稱+'%'')'; IF @程式語言 <> '' SET @條件 += N' OR (X3.程式語言 LIKE ''%'+@程式語言+'%'')'; SET @參數 = N'@函式名稱 NVARCHAR(255),@程式語言 NVARCHAR(255),@起始行 INT,@結束行 INT'; SET @語法 = REPLACE(@語法,'{0}',@條件) SET @語法2 = REPLACE(@語法2,'{0}',@條件) SET @語法 = REPLACE(@語法,'(1=1) OR','(1=1) AND') SET @語法2 = REPLACE(@語法2,'(1=1) OR','(1=1) AND') -- 分頁 IF @起始行 > @結束行 BEGIN SET @起始行 = 0 SET @結束行 = 0 END IF @起始行 <> 0 AND @結束行 <> 0 BEGIN SET @語法 = REPLACE(@語法,'{1}','WHERE ROWID BETWEEN @起始行 AND @結束行') END ELSE BEGIN SET @語法 = REPLACE(@語法,'{1}','') END PRINT @語法 EXEC Sp_ExecuteSQL @語法,@參數 ,@函式名稱 = @函式名稱 ,@程式語言 = @程式語言 ,@起始行 = @起始行 ,@結束行 = @結束行 -- 總筆數 SET @顯示欄位 = N'SELECT ISNULL(COUNT(*),0) AS 總數量' SET @語法2 = @顯示欄位 + @語法2 SET @語法2 = REPLACE(@語法2,'{1}','') PRINT '' PRINT @語法2 EXEC Sp_ExecuteSQL @語法2,@參數 ,@函式名稱 = @函式名稱 ,@程式語言 = @程式語言 ,@起始行 = @起始行 ,@結束行 = @結束行 END