跳到主要內容

發表文章

[JavaScript] 多個 input Checkbox(Radiobutton) 像陣列取值

[HTML] <head runat="server">     <script type="text/javascript">         function chkvalue(theform) {                 var listLen = theform.namedata.length; //計算 namedata 數量             var str= ""             for (var i = 0; i < listLen; i++) {                 if (theform.namedata[i].checked) { //如果checked                     intr += theform.namedata[i].value + " " //取值                 }             }             if ( len(str) > 0 ) {                  alert("checked value : " + intr)             }                 }  ...

[Ajax] 利用 POST 同步傳值

//index.aspx [HTML] <head>  <script type="text/javascript">      function invoiceLog( d1 , d2 ) {          $.ajax({              type: 'POST',              contentType: 'application/json;',              data: '{data1:"' + d1 + '", data2:"' + d2 + '"}', //傳值              dataType: 'json',              async: false,              url: 'url.aspx/ FunctionName ', //url.aspx:傳值到指定的網址 ; FunctionName:呼叫.cs的function              success: function (result) {                  alert(result.d.RtnMsg);  //              }          });      }     </scr...

[T-SQL] 分割字串

DECLARE @CIndex smallint; DECLARE @InputString VARCHAR(1000); DECLARE @Split1 VARCHAR(1000); SET @InputString= '1025,1033,1014,' SET @CIndex=CHARINDEX(',',@InputString) WHILE  NOT(@CIndex = 0) BEGIN SET @Split1=RTRIM(LTRIM(LEFT(@InputString, @CIndex - 1))) --取出前一段字串後剩餘的字串 SET @InputString = RIGHT(@InputString, LEN(@InputString) - @CIndex) SET @CIndex=CHARINDEX(',',@InputString) END 參考連結 http://mydiamond.pixnet.net/blog/post/22415645-sql-split

[HTML] 文字過長之截斷 或 字串+"..."

  原始字串:"我是標準字串拉拉拉拉拉拉拉拉拉我是標準字串拉拉拉 " 文字超過指定寬度--> "我是標準字串拉拉拉... " style="overflow:hidden;text-overflow:ellipsis;white-space: nowrap;width:420px" 文字強迫截斷,不換行 --> "我是標準字串拉拉拉" style="word-break: break-all;"

[ASP.NET] 解決 JQuery 之 Reload 時失效問題

[HTML]  <script type="text/javascript">         function JQreload() {             Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);         }         function EndRequestHandler() {             //這裡放要執行的JQuery,直接複製一模一樣的就可以囉^^         }     </script> [.CS]  protected void Page_Load(object sender, EventArgs e)  {        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script                                       type=\"text/javascript\">JQreload();</script>");     }

[ASP.NET] 利用 WebForm_DoCallback 傳取值

[HTML] <head runat="server">  <script type="text/javascript">             function btnCall(c) {             CallTheServer(c, "");         }         function CallTheServer(arg, context) {             WebForm_DoCallback('__Page', arg, ReceiveServerData, context, null, false)         }         function ReceiveServerData(result) {             document.getElementById('ID').innerHTML = result;   //取值         }     </script> </head> <body>  <form id="form1" runat="server"> <!--呼叫function--> <a href='#' onclick='btnCall(<%#Eval("ID") %>);return false;' >  </form> </body> [.CS] public partial class PageName: System.Web.UI.Page, ICallbackEventHandler { ...