但有時在asp.net webform visable = false時就會找不到物件
因為dom裡並沒有所以要判斷一下物件是否存在
var aTag = $('#abc');
if (!aTag.length)
return;
參考網址點我前往
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;
}
參考來源
$('#top').click(function () {
$('body,html').animate({ scrollTop: 0 }, 300);
});
bottom
$('#bottom').click(function () {
$('body,html').animate({ scrollTop: $(document).height() }, 300);
});
PageDown
$('#PageDown').click(function () {
$('body,html').animate({ scrollTop: $(window).scrollTop() + 300 }, 300);
});
PageUp
$('#PageUp').click(function () {
$('body,html').animate({ scrollTop: $(window).scrollTop() - 300 }, 300);
});
.fancybox-nav {
position: absolute;
top: 0;
/*width: 40%;Marco*/
width: 60px;
height: 100%;
cursor: pointer;
text-decoration: none;
background: transparent url('blank.gif'); /* helps IE */
-webkit-tap-highlight-color: rgba(0,0,0,0);
z-index: 8040;
}
.fancybox-prev {
/* left: 0;Marco */
left: -60px;
}
.fancybox-next {
/* right: 0; Marco */
right: -60px;
}