網路上能找到一堆已經寫好的表示法如驗證身份證...
所以也只是照著copy沒有很懂
最近開始用比較前端的方式去開發程式
所以JS變的特別重要
看了兩篇文章後發覺好像懂了正規表達如何寫了
以下圖片來自正規表示法圖說

以上備忘改天比較好查
參考網址
正規表示法圖說
metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string=&Quot;Data Source=192.168.1.1;initial catalog=test;user id=sa;password=1234;multipleactiveresultsets=True;App=EntityFramework&Quot;寫一個function
public static string getEntitiesConn()
{
string test = CodeClass.Decrypt(System.Configuration.ConfigurationManager.ConnectionStrings["testEntities"].ToString());
return test;
}
解密出來
metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string=&Quot;Data Source=192.168.1.1;initial catalog=test;user id=sa;password=1234;multipleactiveresultsets=True;App=EntityFramework&Quot;看起來一樣吧
testEntities db = new testEntities(Conn.getEntitiesConn());
不支援關鍵字: 'data source'。是那裡有問題阿仔細一下 &Quot;這東西不就是雙引號嗎
http://maps.googleapis.com/maps/api/geocode/json?address=地址&sensor=true_or_false反向地理編碼
http://maps.googleapis.com/maps/api/geocode/json?latlng=經,緯&sensor=true_or_false參考網址: 點我前往
var aTag = $('#abc');
if (!aTag.length)
return;
參考網址
window.opener.getElementById("abc").value = 'abc';
那用jQeury怎麼做??
$('#abc', opener.document).attr("value",txt);
參考網址
點我前往
btn.button('loading');
發生下列問題
cmd.Parameters.AddWithValue("@abc", (object)item.abc ?? DBNull.Value);
參考網址
$('.ui-autocomplete-input').css('width', '90%');
參考網址
@Html.ActionLink("關於", "About", "Home", "https", "", "", new { id = "1" ,test="000"}, new { @class="abc"})
@Url.Action("About","Home",null,"https","")
$(function () {
if (window.location.protocol != "https:") {
var sslUrl = location.href.replace(/^http/i, "https");
window.location.href = sslUrl;
return;
}
});
參考網站<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click"></asp:LinkButton>
javascript: __doPostBack('<%= LinkButton1.UniqueID %>', '');
參考網址
/// <summary>
/// 遮罩電話 (十個字 手機市話)(九個字 市話)(十個字以上前四後三)(四個字以下回傳空白)
/// </summary>
/// <param name="pStr">字串</param>
/// <returns>string</returns>
public static string MaskString(string pStr)
{
string mReturn = "";
if (pStr.Length == 9 && pStr.StartsWith("0")) //9碼的如高雄
{
mReturn = pStr.Substring(0,2) + "-XXX-" + pStr.Substring(5,4);
}
else if (pStr.Length == 10 && pStr.StartsWith("09"))//手機
{
mReturn = pStr.Substring(0, 4) + "-XXX-" + pStr.Substring(7, 3);
}
else if (pStr.Length == 10 && pStr.StartsWith("0"))//台北市話
{
mReturn = pStr.Substring(0, 2) + "-XXXX-" + pStr.Substring(6, 4);
}
else
{
if (pStr.Length > 10)//十個字以上
{
for (int i = 0; i < pStr.Length ; i++)
{
if ((i == 0 || i <= 3) || (i >= pStr.Length - 3)) //前四個字 後三個字出現
{
mReturn += pStr.Substring(i, 1);
}
else
{
mReturn += "X";
}
}
}
else if(pStr.Length >= 4)//四個字以上才會做
{
for (int i = 0; i < pStr.Length; i++)
{
if (i >= pStr.Length - 3) //後三個字出現
{
mReturn += pStr.Substring(i, 1);
}
else
{
mReturn += "X";
}
}
}
}
return mReturn;
}
Label1.Text = Resources.Resource.名稱;在aspx
Text='<%$ Resources:Resource, 名稱%>'在js or 網頁中
var StringTimeFormatError = "<%= Resources.Resource.名稱 %>"; alert(StringTimeFormatError );在MVC 網頁中
@Resources.Resource.名稱 <system.web> <globalization culture="auto" uiCulture="auto" enableClientBasedCulture="true"/> </system.web>參考網址
$("#datae").datepicker({
beforeShowDay: setDisableDate //設定日期的function
});
var DisableDate = [];//日期陣列
//可以用ajax post之類來帶入資料
//todo
//設定的function Elaine Wu
function setDisableDate(date) {
var strDate = date.getFullYear() + "-" + toTen(date.getMonth() + 1) + "-" + toTen(date.getDate());
var aryReturn = [true, ""];
$.each(DisableDate, function (key, value) {
if (value == strDate) {
aryReturn = [false, "", "已設定不能選擇"];
}
});
return aryReturn;
}
function toTen(s) {
return s < 10 ? '0' + s : s;
}
參考來源