PIXNET Logo登入

<font color="#FF0000">人生過程精彩才是重點</font>

跳到主文

介紹與分享 Asp.net Javascript,程式語言 介紹新聞,好文與最新流行資訊 愛電影與愛旅行與美食的包爾博

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 8月 05 週四 201014:48
  • [Javascript] ShadowBox JS 使用說明

很多人看了官方網頁還是不太懂這燈箱該如何使用
因此我寫一下如何使用給大家看好了
只要照著做應該很容易就可以使用這美麗的燈箱JS
 
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(2) 人氣(2,450)

  • 個人分類:Javascript
▲top
  • 1月 25 週一 201014:47
  • [jQuery]新型態的jQuery 圖形驗證 Captcha

jQuery SimpleCaptcha最近發現jQuery也有Captcha
下面便介紹兩種Captcha
傳統上,大多數的網站都是用數字驗證or英文+數字混合來做驗證
但最近jQuery有人製作出用選圖來做驗證
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(2) 人氣(5,881)

  • 個人分類:Javascript
▲top
  • 1月 06 週三 201017:33
  • JSON + jQuery +Asp.Net C# 使用心得

今天一整天都在使用JSON,用到頭昏眼花
看了一堆前人的code,然後使用我最擅長的Copy and Paste大法
剛開始不去抓資料庫資料,還算順利,一下就出現結果
可是呢,當我需要開始撈自己資料庫時,卻一直像鬼打牆般的資料出不來
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(1) 人氣(19,988)

  • 個人分類:Javascript
▲top
  • 6月 26 週五 200914:07
  • [Javascript]動態產生的checkbox 判斷是否有被勾選到

動態產生的checkbox 若要做判斷是否有被勾選到
最基本的方法就是
  for( int i = 0; i < checkboxlist.length; i++ )
    {
       if( checkboxlist[ i ].checked )
       {
          // do other stuff
       }
    }
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(5,139)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:40
  • [Css+Javascript]改變Input File的Style,Styling File Inputs with CSS

<html>
<head>
 <title>File Upload Example</title>
 <script language=”JavaScript” type=”text/javascript”>
 function HandleFileButtonClick()
 {
  document.frmUpload.myFile.click();
  document.frmUpload.txtFakeText.value = document.frmUpload.myFile.value;
 }
 </script>
</head>
<body>
<form name=”frmUpload”>
<!– Real Input field, but hidden–>
<input type=”file” name=”myFile” style=”display: none”>
<!– Fake field to fool the user –>
<input type=”text” name=”txtFakeText” readonly=”true”>
<!– Button to invoke the click of the File Input –>
<input type=”button” onclick=”HandleFileButtonClick();” value=”Upload File” style=”background: red;”>
</form>
</body>
</html>
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(2,050)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:37
  • [Javascript] 換圖片 Change Image

<SCRIPT language=”JavaScript”>
<!– Begin
function movepic(img_name,img_src) {
document.getElementById(img_name).src=img_src;
}
// End –>
</SCRIPT>
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(7,840)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:37
  • [Javascript]判斷是否用IE瀏覽器

function detectBrowser()//判斷是否用IE瀏覽器
 { 
  var sAgent = navigator.userAgent.toLowerCase();
  this.isIE = (sAgent.indexOf(”msie”)!=-1); //IE6.0-7
  this.isFF = (sAgent.indexOf(”firefox”)!=-1);//firefox
  this.isSa = (sAgent.indexOf(”safari”)!=-1);//safari
  this.isOp = (sAgent.indexOf(”opera”)!=-1);//opera
  this.isNN = (sAgent.indexOf(”netscape”)!=-1);//netscape
  this.isMa = this.isIE;//marthon
  this.isOther = (!this.isIE && !this.isFF && !this.isSa && !this.isOp && !this.isNN && !this.isSa);//unknown Browser
 }
 var oBrowser = new detectBrowser();
 if (!oBrowser.isIE)
 {
     alert(”Please use IE6.0/7.0(or above version).”);
 }
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(6,505)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:33
  • [JavaScript]html&web control的各功能驗證寫法


* 與各個function程式碼相連的設定:
   <form id=”FORM1″ name=”form1″ onsubmit=”return checkform(document.forms[0]);” action=”WebForm1.aspx”
* 範例:HarBaLife2 和 AmwayText1
* 欄位設定:
   姓名:20 、電話:25、地址:50、信箱:50、身高:3、說明(理由):100
   資料庫設定:id:int.4(nchar.5)、name:varchar.50、sex:char.1、phone:varchar.30、BirthDate:datetime.8、address:varchar.60、mail:varchar.50、Height:numeric.9、CheckBoxList:varchar.100、RadioButton:char.1、why:nvarchar.200、writeDate:datetime.8(預設值-(getdate()))、Photo:image.16
               UserName:varchar.10、UserPasseword:varchar.10
myform=document.forms[0];//以下為它的二種寫法
<FORM id=”Form1″ name=”form1″ onsubmit=”return checkform(1);” method=”post” runat=”server”>
<FORM id=”Form1″ name=”form1″ onsubmit=”return checkform(document.forms[0]);” method=”post” runat=”server”>
————————————————————————————————————————–
<<>>
  為避免填寫人在txt欄內填寫「<>」符號,故用程式碼設定-當填寫人填寫到<>時,則自動轉換成文字。
(1)在html語法上加上【validateRequest=”false”】:
 
  ex:<%@ Page language=”c#” Codebehind=”page_test.aspx.cs” AutoEventWireup=”false” Inherits=”AmwayTest_test.WebForm1″  validateRequest=”false” enableViewStateMac=”True”%>
 (2)在apsx程式碼內加上:
  private string CheckInputData(string strInput)
   {
         strInput = strInput.Trim();
         strInput = strInput.Replace(”‘”,”");
         strInput = strInput.Replace(”–”,”");
         strInput = strInput.Replace(”;”,”");
         strInput = strInput.Replace(”\”",”");
         strInput = strInput.Replace(”<”,”<”);
         return strInput;
   }
function DateDemo()
{
???var d, s = “Today’s date is:”;
???d = new Date();
???s += (d.getMonth() + 1) + “/”;
???s += d.getDate() + “/”;
???s += d.getYear();
???return(s);
}
<txt>
html control驗證:
(1)namevalue=myform.name.value;
  
(2)   if (namevalue==”") 
      {
       alert (’您尚未填寫【姓名】!’);
       return false;
      }
web control驗證:
(1)if(document.FORM1.Question1[0].checked!=true && document.FORM1.Question1[1].checked!=true && document.FORM1.Question1[3].checked!=true && document.FORM1.Question1[3].checked!=true && document.FORM1.Question1[4].checked!=true && document.FORM1.Question1[4].checked!=true)
   {
 alert(”您對於您每天喝的飲用水品質覺得安心嗎?”);
 document.FORM1.Question1[0].focus();
 return false;
   }
radio為單選狀態
//Question4為欄位id,[n]的n為radio內所包含的選擇單子。
<Radiobutton>
html control驗證:
(1)sexvalue=myform.sex;
(2)if ( RadioChk (sexvalue)==false  ) 
   { 
  alert (’您尚未選擇【性別】!’);
  return false;
   }
(3)
function RadioChk (myRadio)
{
 var checked = false;
 for ( i =0 ; i < myRadio.length; i++)
 {
  if (myRadio[i].checked )
  {
   checked = true;
  }
 }
   
    return checked;
}
web control驗證:
(1)if(document.FORM1.Question4[0].checked!=true && document.FORM1.Question4[1].checked!=true && document.FORM1.Question4[2].checked!=true && document.FORM1.Question4[3].checked!=true && document.FORM1.Question4[4].checked!=true)
  {
  alert(”請問您對台灣整體的飲用水品質的評價?”);
  document.FORM1.Question4[0].focus();
  return false;
  } 
<RadiobuttonList+理由>
web control
//抓「其他」此欄的id,再判斷是否讓「理由」欄的id呈現出來
(1)function Validator()
     {
   
  if(document.getElementById(’Question5_5′).checked)
  {
   document.FORM1.txtQ5_Extra.disabled=false;  
  }
  else
  {
        document.FORM1.txtQ5_Extra.disabled=true;
    
  } 
     }
<dropdownlist>
html control驗證:
Expectationvalue=myform.Expectation.selectedIndex;
if ( Expectationvalue==0)
 {
       alert (” 您尚未選擇【希望可以】! “);
       return false;
 }
web control驗證:
 if(stQuestion2==false)
  {
 alert(’您認為台灣哪一個縣市的飲用水品質最好?’);
        document.FORM1.Select1.focus();
 return false; 
  } 
checkboxlist為複選狀態
<checkboxlist>
html control+驗證:
(1)
<form id=”FORM1″ name=”form1″ onsubmit=”return checkform(document.forms[0]);” action=”WebForm1.aspx”
(2)
 function MultiValidator(myform)
{
 for(var i=0; i<myform.elements.length; i++)
 {
  var e = myform.elements[i];
  if( (e.type==’checkbox’) && e.name.indexOf(’CheckBoxList’) >=0 && (e.checked == true) )
  {
   return true;
  }
 }
 
 return false;
}
function Checkchkothers(myform)
{
 chkOthersvalue=myform.chkOthers.checked;
 if (chkOthersvalue==true)
 {return true;}
 else
 {return false;}
}
function Checktxtothers(myform)
{
 txtOthersvalue=myform.txtOthers.value; 
 if (txtOthersvalue==”")
 {return false;}
 else
 {return true;}
}
(3)
 「其他」此欄需在html語法中加:onclick=”EnableUploadSample(document.forms[0])”
  ex:<input id=”chkOthers” onclick=”EnableUploadSample(document.forms[0])” type=”checkbox” CHECKED
 value=”9″ name=”chkOthers” runat=”server”>
function EnableUploadSample(myform)
{
 var txtOthers=document.getElementById(’txtOthers’);
 if(myform.chkOthers.checked)
 {   
  txtOthers.disabled=false;
 } 
 else
 { 
                txtOthers.value=”";
  txtOthers.disabled=true;
 }
}
(4)
function checkform (myform)
{
  if(MultiValidator(myform)==false && Checkchkothers(myform)==false && Checktxtothers(myform)==false)
  {
 alert(’您尚未選擇【減重方式】!’);
 return false;
  }
  else if(MultiValidator(myform)==false && Checkchkothers(myform)==true && Checktxtothers(myform)==false)
  {
 alert(’您尚未填寫【其它方式】!’);
 return false;
  }
  else if(MultiValidator(myform)==true && Checkchkothers(myform)==true && Checktxtothers(myform)==false)
  {
 alert(’您尚未填寫【其它方式】’);
 return false;
  } 
}
(5)
 因為是複選題,故需在asps程式碼內設定「值與值間的分隔符號」。
foreach (ListItem item in Question10.Items)
{
 if (item.Selected)
 {
  strQuestion10+=item.Value+”;”;
 }
}
strQuestion10=strQuestion10.Substring(0,strQuestion10.Length-1);
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(1,133)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:32
  • [JavaScript]可以拷貝代碼到剪貼板上Clipboard cut, copy and paste with JavaScript


<script type=”text/javascript”>
function CutToClipboard()
{
   CutTxt = document.selection.createRange();
   CutTxt.execCommand(”Cut”);
}
function CopyToClipboard()
{
   CopiedTxt = document.selection.createRange();
   CopiedTxt.execCommand(”Copy”);
}
function PasteFromClipboard()
{
   document.Form1.txtArea.focus();
   PastedText = document.Form1.txtArea.createTextRange();
   PastedText.execCommand(”Paste”);
}
</script>
 
And the markup:
 
 <form name=”Form1″>
Select this text, copy it using the copy button, and paste it below.<br /><br />
<textarea id=”txtArea” cols=”60″ rows=”5″></textarea>
<br />
<input type=”button” onClick=”CutToClipboard()” value=”Cut to clipboard” />
<input type=”button” onClick=”CopyToClipboard()” value=”Copy to clipboard” />
<input type=”button” onClick=”PasteFromClipboard()” value=”Paste from clipboard” />
</form>
====================================================
上面的Code有可能不能用,不能的話就試試看下面的
    <script type=”text/javascript”>
function CopyToClipboard()
{
   document.Form1.txtArea.focus();
   document.Form1.txtArea.select();
   CopiedTxt = document.selection.createRange();
   CopiedTxt.execCommand(”Copy”);
}
</script>
<textarea id=”txtArea” cols=”60″ rows=”5″>You can also copy text from this textarea. Or you can paste the text here, using the Ctrl+V key combination.</textarea>
<br />
<input type=”button” onClick=”CopyToClipboard()” value=”Copy to clipboard” />
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(3,782)

  • 個人分類:Javascript
▲top
  • 5月 07 週四 200909:31
  • [javascript]電話號碼驗證


電話號碼驗證
[.Net]
<asp:regularexpressionvalidator id=”Validphonenum” ControlToValidate=”phonenum”  Display=”Static” ValidationExpression=”\(0\d{1}\)\d{4}\-\d{4}|\(0\d{1}\)\d{3}\-\d{5}|\(0\d{2}\)\d{3}\-\d{3}|\(0\d{3}\)\d{6}” runat=”server” ErrorMessage=”電話號碼格式有誤”>
[javascript]
if(NaN(txtphone.text))
{
 alert();
 return false;
}
========================================================
<script language=”javascript”>
function CheckForm(myForm)
  {
   var sHours=myForm.txtHours.value;
    if(sHours==”")
     {
      alert (” 請填入課程時數”);
      myForm.txtHours.focus();
     }
    else
     {
      if(isNaN(sHours))
       {
        alert(” 請填入課程時數為數值 “);
        myForm.txtHours.focus();
        
        return false;    
       }
     }
  }
</script>
<INPUT id=”txtHours” onblur=”CheckForm(document.forms[0])” type=”text” name=”txtHours”   runat=”server”>
(繼續閱讀...)
文章標籤

包爾伯 發表在 痞客邦 留言(0) 人氣(3,194)

  • 個人分類:Javascript
▲top
12»

個人頭像

包爾伯
暱稱:
包爾伯
分類:
數位生活
好友:
累積中
地區:

文章搜尋

文章分類

toggle 房屋買賣知識 (2)
  • 房仲手段大破解 (4)
  • [轉載]黑心建商的告白 (17)
toggle 新聞News (3)
  • 新聞與政治 (50)
  • 新聞 (7)
  • 嗜好 (13)
toggle 電腦資訊PC world (2)
  • 電腦 (20)
  • 電腦和網際網路 (72)
toggle Apple (4)
  • 敗家 (1)
  • iOS (4)
  • Apple (15)
  • iphone (16)
toggle 攝影Photo (4)
  • 攝影 (24)
  • 攝影相關 (9)
  • Flickr (2)
  • 攝影器材 (8)
toggle 音樂Music (1)
  • 音樂 (28)
toggle 影集Tv Show,Drama (2)
  • 日本影集 (9)
  • 歐美影集 (45)
toggle 電玩GAME (4)
  • PSP (3)
  • XBOX 360 (2)
  • 遊戲 (4)
  • PC Game (4)
toggle 美食。食記Foods (3)
  • 台北美食 (2)
  • 飲食 (7)
  • 台南美食 (7)
toggle 電影Movie (3)
  • 亞洲電影 (11)
  • 歐美電影 (45)
  • 電影 (54)
toggle 娛樂 (2)
  • FUNNY笑話,趣事 (82)
  • 娛樂 (105)
toggle 旅遊 (10)
  • 台灣 (1)
  • 旅行兩三事 (1)
  • 香港 (23)
  • 日本 (1)
  • 2012-泰國Thailand-曼谷Bangkok (24)
  • 2014-泰國Thailand-曼谷Bangkok (12)
  • 台南 (1)
  • 旅行 (52)
  • Korea韓國 (0)
  • 吳哥窟 (12)
toggle 體育Sport (3)
  • 運動 (1)
  • 籃球 (5)
  • 體育 (18)
toggle 程式語言 (10)
  • CSS (4)
  • PostgreSQL (3)
  • Asp.Net (20)
  • Javascript (18)
  • 程式 (1)
  • MS-SQL (1)
  • Windows (1)
  • jQuery (3)
  • Android (1)
  • 推薦網站 (1)
toggle 心情,工作 (2)
  • 工作 (8)
  • 心情 (44)
  • 健康 (1)
  • 美學 (2)
  • 圖書 (18)
  • 汽機車 (6)
  • 財經 (7)
  • 知識 (106)
  • 好文 (33)
  • 未分類文章 (1)

熱門文章

  • (16,161)[.NET]UTF-8轉換BIG5
  • (24,978)[轉] [討論] 跟正妹做愛真的會比較爽嗎?
  • (53,112)Michael Jackson - Billie Jean 歌詞
  • (8,839)麥克傑克遜Michael Jackson 月球漫步Moonwalk教學
  • (17,219)又一經典輕便隨身底片機 - Contax TVS I
  • (7,403)Guns N' Roses - November Rain
  • (29,651)[轉]Leica徠卡M口鏡頭詳談
  • (14,764)推薦 Spartacus:Blood and Sand
  • (9,375)[電影]Forgetting Sarah Marshall 忘掉負心女
  • (5,228)Call of Duty: Black Ops 決勝時刻:黑色行動 完整全劇情簡體中文漢化發布

近期文章

  • [影集] American Crime Story美國犯罪故事
  • [電影]Star Wars: The Force Awakens 星際大戰7:原力覺醒
  • [電影]The throne (2015)思悼
  • [電影]The Little Prince (2015)小王子
  • [電影]Turbo Kid渦輪小子-非常復古的科幻電影
  • [廣告]HOMI 兩用傳輸線與捲線器
  • [電影]In the Name of the Father 以父之名
  • [影城情報]喜樂時代影城-即將開幕
  • [電影]Me and Earl and the Dying Girl 青少年狂想曲- 我們的故事未完待續 (我與厄爾與將死去的女孩)
  • [電影]The Martian絕地救援-搶救最欠救的男人

blogAD

自訂側欄

通路王 - Left -01

通路王 - Left -02

自訂側欄

文章彙整

參觀人氣

  • 本日人氣:
  • 累積人氣:

自訂側欄

BloggerAds

自訂側欄

通路王 - Right -01

通路王 - Right -02

誰來我家