日韩欧美中文在线,999视频精品,欧美大成色www永久网站婷http://www.aygfsteel.com/tinguo002/category/52097.html<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- iteye 460 60 --> <ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px" data-ad-client="ca-pub-2876867208357149" data-ad-slot="0418982663"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> zh-cnSun, 01 Feb 2015 13:01:47 GMTSun, 01 Feb 2015 13:01:47 GMT60javascript 代碼 - 金額格式化,每三位加個,http://www.aygfsteel.com/tinguo002/archive/2014/08/18/417078.html一堣而安一堣而安Mon, 18 Aug 2014 08:58:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/08/18/417078.htmlhttp://www.aygfsteel.com/tinguo002/comments/417078.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/08/18/417078.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/417078.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/417078.html/**
 * 金額格式化,每三位加個,
 
*/

function formatMoney1(money){
    
var str = money + "";
    
var result = "";
    
var index = str.indexOf(".");
    
var endStr = "";
    
if(index>-1){
        endStr 
= str.substring(index, str.length);
        endStr 
= endStr.length==3?endStr:endStr+"0";
        str 
= str.substring(0, index);
    }
else{
        endStr 
= ".00";
    }

    
var i = 0;
    
var len = str.length;
    
for(i;i<len;i++){
        
if((len - (4 + i)) % 3 == 0 && (len - (4 + i)) >= 0){
            result 
+= str.substr(i, 1+ ",";
        }
else{
            result 
+= str.substr(i, 1);
        }

    }

    
return result+endStr;
}


一堣而安 2014-08-18 16:58 發表評論
]]>
jQuery 重復加載,導致依賴于 jQuery的JS全部失效問題http://www.aygfsteel.com/tinguo002/archive/2014/07/24/416161.html一堣而安一堣而安Thu, 24 Jul 2014 02:34:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/07/24/416161.htmlhttp://www.aygfsteel.com/tinguo002/comments/416161.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/07/24/416161.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/416161.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/416161.html父頁面引入子頁面,子頁面引入jQuery.js文件,父頁面JS依賴jQuery.js   ,出現問題是,總提示JS對象無效。猜測jQuery加載順序不是最早造成的。

父頁面:


子頁面:


從這里看 ,jQuery.js   是最早的咯,可是為什么其它的js都提示  屬性無效呢。


后面用 IE11 的F12工具查看 JS 的加載順序,發現  jQuery 是最早加載的,只是加頁面加載完畢后,突然有個請求又加載了一次 jQuery。


原因是如下代碼:
$(function() {
    $("#zjyw_table_1").load("xxx.jsp");
}
xxx.jsp 里又加載了 jQuery.js   。  把這句注釋后就正常了。

這問題還郁悶了挺久,記錄一下,方便其它人哈。

js加載順序的一個文章:http://blog.csdn.net/dannywj1371/article/details/7048076

一堣而安 2014-07-24 10:34 發表評論
]]>
JS中URL編碼參數(UrlEncode) http://www.aygfsteel.com/tinguo002/archive/2014/07/22/416096.html一堣而安一堣而安Tue, 22 Jul 2014 11:09:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/07/22/416096.htmlhttp://www.aygfsteel.com/tinguo002/comments/416096.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/07/22/416096.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/416096.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/416096.htmlJS中URL編碼參數(UrlEncode)
網上有很多文字作品寫涉及在JS中呈現類似UrlEncode功能時都是自定義參數來呈現,其實JS中本身就有那樣的參數。
參數parameter由于用類似URL的形式傳過去 , 所以別直接就那樣賦值
以下是對變量值的URL編碼總結 : 意見用encodeURIComponent() , GET 和POST方法都能夠發送過去
Java編程script中存在幾種對URL字符串停止編碼的竅門:escape(),encodeURI(),以及encodeURIComponent()。這幾種編碼所起的功能各不相同。
escape() 竅門:
采用ISO Latin字符集對指定的字符串停止編碼。所有的空格符、標點符號、特殊字符以及更多有聯系非ASCII字符都將被轉化成%xx各式的字符編碼(xx等于該字符在字符集表里面的編碼的16進制數字)。比如,空格符對應的編碼是%20。
不會被此竅門編碼的字符: @ * / +
encodeURI() 竅門:
把URI字符串采用UTF-8編碼各式轉化成escape各式的字符串。
不會被此竅門編碼的字符:! @ # $& * ( ) = : / ; ? + '
encodeURIComponent() 竅門:
把URI字符串采用UTF-8編碼各式轉化成escape各式的字符串。與encodeURI()相比,那個竅門將對更多的字符停止編碼,比如 / 等字符。所以假如字符串里面包含了URI的幾個部份的話,別用那個竅門來停止編碼,否則 / 字符被編碼之后URL將呈現錯誤。
不會被此竅門編碼的字符:! * ( ) '

因此,對于漢文字符串來說,假如不期望把字符串編碼各式轉化成UTF-8各式的(比如原頁面和目的頁面的charset是一致的時候),只需求應用 escape。假如你的頁面是GB2312或者更多有聯系的編碼,而接受參數parameter的頁面是UTF-8編碼的,就要采用encodeURI或者encodeURIComponent。

文章詳細參考:http://www.cnblogs.com/neru/archive/2010/07/10/1774718.html



一堣而安 2014-07-22 19:09 發表評論
]]>
HTML 轉義字符http://www.aygfsteel.com/tinguo002/archive/2014/07/02/415358.html一堣而安一堣而安Wed, 02 Jul 2014 02:42:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/07/02/415358.htmlhttp://www.aygfsteel.com/tinguo002/comments/415358.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/07/02/415358.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/415358.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/415358.htmlhttp://114.xixik.com/character/

一堣而安 2014-07-02 10:42 發表評論
]]>
WEB 打印,去頁碼、隱藏打印按鈕http://www.aygfsteel.com/tinguo002/archive/2014/06/28/415249.html一堣而安一堣而安Sat, 28 Jun 2014 13:49:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/06/28/415249.htmlhttp://www.aygfsteel.com/tinguo002/comments/415249.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/06/28/415249.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/415249.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/415249.html詳細參考:http://www.cnblogs.com/aidd2008/archive/2012/04/25/2469994.html

JSP代碼如下:

<%@page import="java.net.URLDecoder"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
 String path = request.getContextPath();
 String basePath = request.getScheme() + "://"
   + request.getServerName() + ":" + request.getServerPort()
   + path + "/";
 String params = request.getParameter("params");
 params = URLDecoder.decode(params, "UTF-8");
 String[] arr = new String[8];
 if (params != null) {
  arr = params.split(",");
 }
 request.setAttribute("arr", arr);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html>
<head>
<base href="<%=basePath%>">

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
 <link rel="stylesheet" type="text/css" href="styles.css">
 -->
<style media=print>
.Noprint {
 display: none;
}

.PageNext {
 page-break-after: always;
}

</style>
<style type="text/css">
.helpSpan{ 
 margin-left:20px;
 cursor:pointer;
 display:inline-block;
 color:blue;
}
</style>
<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script>
<title>打印單</title>
<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
<link rel="stylesheet" type="text/css"
 href="css/gzjrzcjys/editFrame.css" />
 <script type="text/javascript">
  function print1(){
   document.all.WebBrowser.ExecWB(6,6);
  }
  function wOpen(){
   $("span.open").hide();
   $("span.close").show();
   $("#helpContent").show();
  }
  function wClose(){
   $("span.open").show();
   $("span.close").hide();
   $("#helpContent").hide();
  }
   var hkey_root, hkey_path, hkey_key;
         hkey_root = "HKEY_CURRENT_USER";
         hkey_path = "
\\software\\Microsoft\\Internet Explorer\\PageSetup\\";
         //設置網頁打印的頁眉頁腳邊距為空
         function pagesetup_null() {
             try {
                 var RegWsh = new ActiveXObject("WScript.Shell");
                 hkey_key = "header";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
                 hkey_key = "footer";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
                 hkey_key = "margin_left";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                 hkey_key = "margin_right";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                 hkey_key = "margin_top";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
                 hkey_key = "margin_bottom";
                 RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.0");
             } catch (e) {
              alert(e);
             }
         }

  $(document).ready(function(){
   pagesetup_null();
  });
 </script>
</head>

<body>
 <div id="frame">
  <div id="frame_title">線下資金轉入申請</div>
  <div id="frame_content">

   <table class="content">
    <tr>
     <th>收款銀行:</th>
     <td><%=arr[0]%></td>
     <th>收款方全稱:</th>
     <td><%=arr[1]%></td>
    </tr>
    <tr>
     <th>收款方銀行賬號:</th>
     <td><%=arr[2]%></td>
     <th>充值碼:</th>
     <td><%=arr[3]%>(填寫在備注欄)</td>
    </tr>
    <tr>
     <th>匯款銀行:</th>
     <td><%=arr[4]%></td>
     <th>匯款方全稱:</th>
     <td><%=arr[5]%></td>
    </tr>
    <tr>
     <th>匯款賬號:</th>
     <td><%=arr[6]%></td>
     <th>匯款金額:</th>
     <td><%=arr[7]%>&nbsp;元</td>
    </tr>
   </table>


  </div>
  <div id="frame_bottom" class="Noprint">
   <a href="javascript:void(0)" class="button_toRound"><span
    style="font-size:14px;"
    onclick="print1()" class="Noprint">【打印】</span>
   </a>
  </div>
  <div style="padding:12px 5px;background-color:#ffffff" class="Noprint">
   備注: 請到網銀或者銀行辦理轉賬業務,轉賬匯款時,信息必須如實填寫,以避免無法如實到賬而給您的投資造成損失!</div>
 </div>

 <div style="width:750px;margin:auto;margin-top:150px;" class="Noprint">
  <div>友情鏈接:</div>
  <div>
   <table class="content">
    <tr>
     <td><a href="     </td>
     <td><a href="
      target="_blank">建設銀行</a>
     </td>
     <td><a href="
     </td>
     <td><a href="
     </td>
    </tr>
    <tr>
     <td><a href="
      target="_blank">光大銀行</a>
     </td>
     <td><a
      href="
      target="_blank">交通銀行</a>
     </td>
     <td><a href="
      target="_blank">興業銀行</a>
     </td>
     <td><a href="
      target="_blank">郵政儲蓄</a>
     </td>
    </tr>

   </table>
  </div>
 </div>
 <div style="width:750px;margin:auto;margin-top:50px;" class="Noprint">
  <div>幫助:點擊【打印】按鈕沒有反應。<span class="open helpSpan"  onclick="wOpen()">&gt;&gt;&gt;展開</span><span onclick="wClose()" class="close helpSpan" style="display:none;">&lt;&lt;&lt;收起</span></div>
  <div id="helpContent" style="display:none;">
   <p>需要將本站點添加為信任站點。共分為三步。</p>
   <p>第一步:打開IE瀏覽器的 Intenet選項</p>
   <div><img src="<%=path%>/images/open_Intenet_ie8.jpg"/></div>
   <p>或者</p>
   <div><img src="<%=path%>/images/open_Intenet_ie11.jpg"/></div>
   <p style="margin-top:20px;">第二步:添加信任站點</p>
   <div><img src="<%=path%>/images/setXinren_ie11.jpg"/></div>
   <p style="margin-top:20px;">第三步:允許控件運行</p>
   <div><img src="<%=path%>/images/setActive.jpg"/></div>
  </div>
 </div>
 <!--endprint-->
</body>
</html>

代碼中所需圖片如下:








一堣而安 2014-06-28 21:49 發表評論
]]>
web 打印http://www.aygfsteel.com/tinguo002/archive/2014/06/26/415154.html一堣而安一堣而安Thu, 26 Jun 2014 06:40:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/06/26/415154.htmlhttp://www.aygfsteel.com/tinguo002/comments/415154.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/06/26/415154.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/415154.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/415154.htmlhttp://www.jb51.net/article/21444.htm
http://www.downdiy.com/kfyy/php/20140323/9e7b9b20201d3a49bb835efc2edc23d3.html  保持線條被打印



一堣而安 2014-06-26 14:40 發表評論
]]>
JS讀書文件http://www.aygfsteel.com/tinguo002/archive/2014/05/06/413339.html一堣而安一堣而安Tue, 06 May 2014 15:02:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/05/06/413339.htmlhttp://www.aygfsteel.com/tinguo002/comments/413339.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/05/06/413339.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/413339.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/413339.htmlAutomation服務器不能創建對象
最簡單解決方法:打開Internet Explorer “工具”菜單欄中的“選項”一欄,單擊“安全”欄中的“自定義級別”選項卡,將第三項“對沒有標記為安全的activex控件進行初始化和腳本運行”設置成
另外解決辦法參考:http://blog.chinaunix.net/uid-20624711-id-1911481.html


==========
參考:http://www.cnblogs.com/java-boy/archive/2011/03/21/1989911.html

<script type="text/javascript">
/**
 *CreateFile: 測試在電腦上創建一個文件件,并在文件夾里寫進一些數據。
 *
 */
function CreateFile()
{
   var fso, tf;
   fso = new ActiveXObject("Scripting.FileSystemObject");//獲取對象
   tf = fso.CreateTextFile("c:\\testfile.txt", true);//創建一個文件夾
   // 寫一行,并且帶有新行字符。
   tf.WriteLine("Testing 1, 2, 3.") ;
   // 向文件寫三個新行字符。 
   tf.WriteBlankLines(3) ;
   // 寫一行。
   tf.Write ("This is a test.");
   tf.Close();//關閉
}
/**
 *Folder的API:
 *任務 方法
 *創建文件夾。 FileSystemObject.CreateFolder
 *刪除文件夾。 Folder.Delete 或 FileSystemObject.DeleteFolder
 *移動文件夾。 Folder.Move 或 FileSystemObject.MoveFolder
 *復制文件夾。 Folder.Copy 或 FileSystemObject.CopyFolder
 *檢索文件夾的名字。 Folder.Name
 *如果文件夾在驅動器上存在,則找出它。 FileSystemObject.FolderExists
 *獲得現有 Folder 對象的實例。 FileSystemObject.GetFolder
 *找出文件夾的父文件夾名。 FileSystemObject.GetParentFolderName
 *找出系統文件夾的路徑。 FileSystemObject.GetSpecialFolder
 */
function ManipFiles()
{
   var fso, f1, f2, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f1 = fso.CreateTextFile("c:\\testfile.txt", true); //如果當前文件已經存在的話,則覆蓋原有文件
   alert("Writing file <br>");
   // 寫一行。
   f1.Write("This is a test.");
   // 關閉文件。
   f1.Close();
   alert("Moving file to c:\\tmp <br>");
   if(!fso.FolderExists("c:\\tmp")) { //如果tmp目錄不存在,則創建一個目錄
        fso.CreateFolder("c:\\tmp");
   }
   // 獲取 C 的根目錄(C:\)中的文件的句柄。
   f2 = fso.GetFile("c:\\testfile.txt");
   // 把文件移動到 \tmp 目錄。如果這個tmp目錄下已經有testfile.txt文件了,則會出錯。(如果沒有tmp這個文件目錄也會出錯)
   f2.Move ("c:\\tmp\\testfile.txt");
   alert("Copying file to c:\\temp <br>");
   // 把文件復制到 \temp 目錄
   if(!fso.FolderExists("c:\\temp")) {//如果temp目錄不存在,則創建一個目錄
        fso.CreateFolder("c:\\temp");
   }
   f2.Copy ("c:\\temp\\testfile.txt");
   alert("Deleting files <br>");
   // 獲得文件當前位置的句柄。
   f2 = fso.GetFile("c:\\tmp\\testfile.txt");
   f3 = fso.GetFile("c:\\temp\\testfile.txt");
   // 刪除文件。
   f2.Delete();
   f3.Delete();
   //刪除文件夾
   var fdTmp = fso.GetFolder("c:\\tmp");
   var fdTemp = fso.GetFolder("c:\\temp");
   fdTmp.DeleteFolder();
   fdTemp.DeleteFolder();
   alert("All done!");
}

ManipFiles();
//CreateFile();
alert("Ok! Write Over!");
</script>



一堣而安 2014-05-06 23:02 發表評論
]]>
jquery-validate 框架驗證http://www.aygfsteel.com/tinguo002/archive/2014/05/06/413324.html一堣而安一堣而安Tue, 06 May 2014 07:43:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/05/06/413324.htmlhttp://www.aygfsteel.com/tinguo002/comments/413324.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/05/06/413324.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/413324.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/413324.htmlhttp://liuna718-163-com.iteye.com/blog/1914769

/*
動態添加驗證
$("#dzName").rules("add",{ required: true,range:[1,100000000000], messages: { required: "必填項"} });
動態刪除驗證
$("#dzName").rules("remove");
判斷驗證是否全部通過
 if(!$("#entInfoForm").validate().form()){
        alert("如果您保存不了,請先將必填項填寫完整(紅色字體提示'必填項')");
    }
*/


一堣而安 2014-05-06 15:43 發表評論
]]>
jQuery.validate 中文API http://www.aygfsteel.com/tinguo002/archive/2014/05/05/413250.html一堣而安一堣而安Mon, 05 May 2014 01:34:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/05/05/413250.htmlhttp://www.aygfsteel.com/tinguo002/comments/413250.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/05/05/413250.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/413250.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/413250.html參考:http://banu.blog.163.com/blog/static/23146482009111941249376/

一堣而安 2014-05-05 09:34 發表評論
]]>
jQuery onhttp://www.aygfsteel.com/tinguo002/archive/2014/03/15/411071.html一堣而安一堣而安Sat, 15 Mar 2014 09:00:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/03/15/411071.htmlhttp://www.aygfsteel.com/tinguo002/comments/411071.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/03/15/411071.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/411071.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/411071.html

一堣而安 2014-03-15 17:00 發表評論
]]>
JSON.stringify 語法實例講解 http://www.aygfsteel.com/tinguo002/archive/2014/02/27/410411.html一堣而安一堣而安Thu, 27 Feb 2014 15:50:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410411.htmlhttp://www.aygfsteel.com/tinguo002/comments/410411.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410411.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/410411.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/410411.html詳細出處參考:http://www.jb51.net/article/29893.htm
認識javascript也不短的時間了,可是這個用法說實在的,我還是第一次見過,慚愧啊慚愧啊。于是乎,在網上找了寫資料,寫了些例子 希望能給園子們一些幫助。 
作用:這個函數的作用主要是為了系列化對象的。 
可能有些人對系列化這個詞過敏,我的理解很簡單。就是說把原來是對象的類型轉換成字符串類型(或者更確切的說是json類型的)。就這么簡單。打個比方說,你有一個類,那么你可以通過這個方法轉換成相應的json類型的。很簡單吧。 
接著看。 
語法: 
JSON.stringify(value [, replacer] [, space]) 
value:是必須要的字段。就是你輸入的對象,比如數組啊,類啊等等。 
replacer:這個是可選的。它又分為2種方式,一種是方法,第二種是數組。 
情況一:我們先說數據,通過我們后面的實驗可以知道,它是和第一個有關系的。一般來說,我們系列化后的結果是通過鍵值對來進行表示的。 
比如說: 
name:"lan",age:25 
這種形式。 
所以,如果這種形式的話,如果第二個的值在第一個存在,那么的話就以第二個的值做key,第一個值為value進行表示,如果不存在,sorry,忽略。【是不是有點抽象,我也這么覺得,不過你等一下看實驗 就OK了。。呼呼。】 
情況二:如果是方法,那很簡單,就是說把系列化后的每一個對象(記住 是每一個)傳進方法里面進行處理。 
space:很好理解,用什么來做分隔符的。 
1.如果省略的話,那么顯示出來的值 就沒有分隔符。直接輸出來 
2.如果是一個數字的話,那么它就定義縮進幾個字符,當然 如果大于10 ,則最大值為10. 
3.如果是一些轉義字符,比如“\t”,表示回車,那么它每行一個回車。 
4.如果僅僅是字符串,OK,就在每行輸出值的時候把這些字符串附加上去就OK。當然,最大長度也是10個字符。 
開始用實例說明; 
1.只有一個參數的情況下: 
復制代碼 代碼如下:
var student = new Object(); 
student.name = "Lanny"; 
student.age = "25"; 
student.location = "China"; 
var json = JSON.stringify(student); 
alert(student); 
結果如下: 
有些人可能會懷疑JSON.stringify的作用,OK。那假如,我們不要這個函數。代碼下面的樣子: 
復制代碼 代碼如下:
var student = new Object(); 
student.name = "Lanny"; 
student.age = "25"; 
student.location = "China"; 
// var json = JSON.stringify(student); 
alert(student); 
 恭喜你 得到的結果是: 
沒騙你吧,繼續。
2.第二個參數存在,并且第二個參數還是function的時候 
復制代碼 代碼如下:
var students = new Array() ; 
students[0] = "Lanny"; 
students[1] = "dong"; 
students[2] = "I love you"; 
var json = JSON.stringify(students,switchUpper); 
function switchUpper(key, value) { 
return value.toString().toUpperCase(); 
alert(json); 
        //var json = JSON.stringify(students, function (key,value) { 
        //return value.toString().toUpperCase(); 
       //}); 
    上面的方法也可以換成下面的,2個都是一樣,只是寫法有那么一點點的不一樣而已。 
 得到結果如下: 
3.第二個參數存在,并且第二個參數不是function,而是數組的時候。 
3.1 【誤區】如果第一個參數是數組,第二個參數也是數組的話,只顯示第一個參數的值。 
比如: 
復制代碼 代碼如下:
var students = new Array() ; 
students[0] = "Lanny"; 
students[1] = "dong"; 
students[2] = "I love you"; 
var stu = new Array(); 
stu[0] = "1"; 
stu[1] = "2"; 
var json = JSON.stringify(students,stu); 
alert(json); 
 sorry 得到的結果就是: 
第二個被忽略了,只是第一個被系列化了。 
3.2 如果第一個是對象(這里說的對象就像在C#里面可以進行new的),第二個是數組的。 
那么如果第二個的value在第一個存在,那么的話就以第二個的值做key,第一個值為value進行表示 
復制代碼 代碼如下:
var student = new Object(); 
student.qq = "5485891512"; 
student.name = "Lanny"; 
student.age = 25; 
var stu = new Array(); 
stu[0] = "qq"; 
stu[1] = "age"; 
stu[2] = "Hi";//這個student對象里不存在。 
var json = JSON.stringify(student,stu); 
alert(json); 
 得到的結果如下: 
因為stu[2] = "Hi";這個Hi 在第一個找不到,所以就不進行顯示了。 
4.第三個參數 
4.1.如果省略的話,那么顯示出來的值 就沒有分隔符。直接輸出來 
比如: 
復制代碼 代碼如下:
var student = new Object(); 
student.qq = "5485891512"; 
student.name = "Lanny"; 
student.age = 25; 
var stu = new Array(); 
stu[0] = "qq"; 
stu[1] = "age"; 
stu[2] = "Hi"; 
var json = JSON.stringify(student,stu); 
alert(json); 
 輸出的就是: 
4.2.如果是一個數字的話,那么它就定義縮進幾個字符,當然 如果大于10 ,則最大值為10. 
復制代碼 代碼如下:
var student = new Object(); 
student.qq = "5485891512"; 
student.name = "Lanny"; 
student.age = 25; 
var stu = new Array(); 
stu[0] = "qq"; 
stu[1] = "age"; 
stu[2] = "Hi"; 
var json = JSON.stringify(student,stu,100);//注意這里的100 
alert(json); 
那么得到的是: 
空開來了10個字符。 
4.3.如果是一些轉義字符,比如“\t”,表示回車,那么它每行一個回車。 
也是一樣。 
4.4.如果僅僅是字符串,OK,就在每行輸出值的時候把這些字符串附加上去就OK。當然,最大長度也是10個字符。 
如果是var json = JSON.stringify(student,stu,“HaiKou”);// 
就這樣吧 。good night。 
詳細出處參考:http://www.jb51.net/article/29893.htm


一堣而安 2014-02-27 23:50 發表評論
]]>
JSONObject put,accumulate,element的區別 http://www.aygfsteel.com/tinguo002/archive/2014/02/27/410408.html一堣而安一堣而安Thu, 27 Feb 2014 15:24:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410408.htmlhttp://www.aygfsteel.com/tinguo002/comments/410408.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410408.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/410408.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/410408.htmlpublic Object put (Object key, Object value) 將value映射到key下。如果此JSONObject對象之前存在一個value在這個key下,當前的value會替換掉之前的value
Associates the specified value with the specified key in this map(optional operation). If the map previously contained . a mapping for this key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true .))
public JSONObject accumulate (String key, Object value) 累積value到這個key下。這個方法同element()方法類似,特殊的是,如果當前已經存在一個value在這個key下那么一個JSONArray將會存儲在這個key下來保存所有累積的value。如果已經存在一個JSONArray,那么當前的value就會添加到這個JSONArray中
。相比之下replace方法會替代先前的value
Accumulate values under a key. It is similar to the element method except that if there is already an object stored 
under the key then a JSONArray is stored under the key to hold all of the accumulated values. If there is already a 
JSONArray, then the new value is appended to it. In contrast, the replace method replaces the previous value.
public JSONObject element (String key, Object value) 將鍵/值對放到這個JSONObject對象里面。如果當前value為空(null),那么如果這個key存在的話,這個key就會移除掉。如果這
個key之前有value值,那么此方法會調用accumulate()方法。
Put a key/value pair in the JSONObject. If the value is null, then the key will be removed from the JSONObject if it is 
present. If there is a previous value assigned to the key, it will call accumulate.

轉載:http://ljhzzyx.blog.163.com/blog/static/3838031220126810430157/


一堣而安 2014-02-27 23:24 發表評論
]]>
JSONObject對象使用http://www.aygfsteel.com/tinguo002/archive/2014/02/27/410407.html一堣而安一堣而安Thu, 27 Feb 2014 15:07:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410407.htmlhttp://www.aygfsteel.com/tinguo002/comments/410407.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/02/27/410407.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/410407.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/410407.html
JSON net.sf.json

1.JAR包簡介

要使程序可以運行必須引入JSON-lib包,JSON-lib包同時依賴于以下的JAR包:

  1. commons-lang.jar
  2. commons-beanutils.jar
  3. commons-collections.jar
  4. commons-logging.jar 
  5. ezmorph.jar
  6. json-lib-2.2.2-jdk15.jar

2.JSONObject對象使用

JSON-lib包是一個beans,collections,maps,java arrays 和XML和JSON互相轉換的包。在本例中,我們將使用JSONObject類創建JSONObject對象,然后我們打印這些對象的值。為了使用 JSONObject對象,我們要引入"net.sf.json"包。為了給對象添加元素,我們要使用put()方法。

2.1.實例1

 package jsontest;


import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JSONObjectSample {

    // 創建JSONObject對象
    private static JSONObject createJSONObject() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("username", "huangwuyi");
        jsonObject.put("sex", "男");
        jsonObject.put("QQ", "413425430");
        jsonObject.put("Min.score", new Integer(99));
        jsonObject.put("nickname", "夢中心境");
        return jsonObject;
    }

    public static void main(String[] args) {
        JSONObject jsonObject = JSONObjectSample.createJSONObject();//靜待方法,直接通過類名+方法調用
        
// 輸出jsonobject對象
        System.out.println("jsonObject:" + jsonObject);

        // 判讀輸出對象的類型
        boolean isArray = jsonObject.isArray();
        boolean isEmpty = jsonObject.isEmpty();
        boolean isNullObject = jsonObject.isNullObject();
        System.out.println("是否為數組:" + isArray + ", 是否為空:" + isEmpty
                + ", isNullObject:" + isNullObject);

        // 添加屬性,在jsonObject后面追加元素。
        jsonObject.element("address", "福建省廈門市");
        System.out.println("添加屬性后的對象:" + jsonObject);

        // 返回一個JSONArray對象
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(0, "this is a jsonArray value");
        jsonArray.add(1, "another jsonArray value");
        jsonObject.element("jsonArray", jsonArray);
        //在jsonObject后面住家一個jsonArray
        JSONArray array = jsonObject.getJSONArray("jsonArray");
        System.out.println(jsonObject);
        
        
        System.out.println("返回一個JSONArray對象:" + array);
        // 添加JSONArray后的值
        
// {"username":"huangwuyi","sex":"男","QQ":"413425430","Min.score":99,"nickname":"夢中心境","address":"福建省廈門市","jsonArray":["this is a jsonArray value","another jsonArray value"]}
        System.out.println("結果=" + jsonObject);

        // 根據key返回一個字符串
        String username = jsonObject.getString("username");
        System.out.println("username==>" + username);

        // 把字符轉換為 JSONObject
        String temp = jsonObject.toString();
        JSONObject object = JSONObject.fromObject(temp);
        // 轉換后根據Key返回值
        System.out.println("qq=" + object.get("QQ"));

    }

}

輸出結果

jsonObject:{"username":"huangwuyi","sex":"男","QQ":"413425430","Min.score":99,"nickname":"夢中心境"}
是否為數組:false, 是否為空:false, isNullObject:false
添加屬性后的對象:{"username":"huangwuyi","sex":"男","QQ":"413425430","Min.score":99,"nickname":"夢中心境","address":"福建省廈門市"}
{"username":"huangwuyi","sex":"男","QQ":"413425430","Min.score":99,"nickname":"夢中心境","address":"福建省廈門市","jsonArray":["this is a jsonArray value","another jsonArray value"]}
返回一個JSONArray對象:["this is a jsonArray value","another jsonArray value"]
結果={"username":"huangwuyi","sex":"男","QQ":"413425430","Min.score":99,"nickname":"夢中心境","address":"福建省廈門市","jsonArray":["this is a jsonArray value","another jsonArray value"]}
username==>huangwuyi
qq=413425430

2.2.實例2.

package jsontest;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JSONTest {
    public static void main(String args[])
    {
        JSONObject jsonObj0  = new JSONObject();
        JSONObject jsonObj  = new JSONObject();
        JSONObject jsonObj2  = new JSONObject();
        JSONObject jsonObj3  = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        
        //創建jsonObj0
        jsonObj0.put("name0", "zhangsan");
        jsonObj0.put("sex1", "female");
        System.out.println("jsonObj0:"+jsonObj0);
        
        //創建jsonObj1
        jsonObj.put("name", "xuwei");
        jsonObj.put("sex", "male");
        System.out.println("jsonObj:"+jsonObj);
    
        //創建jsonObj2,包含兩個條目,條目內容分別為jsonObj0,jsonObj1
        jsonObj2.put("item0", jsonObj0);
        jsonObj2.put("item1", jsonObj);
        System.out.println("jsonObj2:"+jsonObj2);
        
        //創建jsonObj3,只有一個條目,內容為jsonObj2
        jsonObj3.element("j3", jsonObj2);
        System.out.println("jsonObj3:"+jsonObj3);
    
        //往JSONArray中添加JSONObject對象。發現JSONArray跟JSONObject的區別就是JSONArray比JSONObject多中括號[]
        jsonArray.add(jsonObj);
        System.out.println("jsonArray:"+jsonArray);
        
        JSONObject jsonObj4  = new JSONObject();
        jsonObj4.element("weather", jsonArray);
        System.out.println("jsonObj4:"+jsonObj4);
    }
}
輸出結果:
jsonObj0:{"name0":"zhangsan","sex1":"female"}
jsonObj:{"name":"xuwei","sex":"male"}
jsonObj2:{"item0":{"name0":"zhangsan","sex1":"female"},"item1":{"name":"xuwei","sex":"male"}}
jsonObj3:{"j3":{"item0":{"name0":"zhangsan","sex1":"female"},"item1":{"name":"xuwei","sex":"male"}}}
jsonArray:[{"name":"xuwei","sex":"male"}]
jsonObj4:{"weather":[{"name":"xuwei","sex":"male"}]}


關于java bean的處理

創建java對象:

public class Address {
 private String road;
 private String streate;
 private String provience;
 private String no;
 public String getRoad() {
  return road;
 }
 public void setRoad(String road) {
  this.road = road;
 }
 public String getStreate() {
  return streate;
 }
 public void setStreate(String streate) {
  this.streate = streate;
 }
 public String getProvience() {
  return provience;
 }
 public void setProvience(String provience) {
  this.provience = provience;
 }
 public String getNo() {
  return no;
 }
 public void setNo(String no) {
  this.no = no;
 }
}

1.將json對象轉化為java對象

 JSONObject jsonObject = JSONObject.fromObject("{\"no\":\"104\",\"provience\":\"陜西\",\"road\":\"高新路\",\"streate\":\"\"}");
  Address Address  = (Address) JSONObject.toBean(jsonObject,Address.class);
  log.info(Address.getNo());
  log.info(Address.getStreate());
  log.info(Address.getProvience());
  log.info(Address.getRoad());

 

2.將java對象轉化為json對象

   將java對象轉化為json對象:

    Address address = new Address();
    address.setNo("104");
    address.setProvience("陜西");
    address.setRoad("高新路");
    address.setStreate("");
    JSONArray json = JSONArray.fromObject(address);
    log.info(json.toString());

 

  將java對象list轉化為json對象:

  Address address = new Address();
  address.setNo("104");
  address.setProvience("陜西");
  address.setRoad("高新路");
  address.setStreate("");
  Address address2 = new Address();
  address2.setNo("105");
  address2.setProvience("陜西");
  address2.setRoad("未央路");
  address2.setStreate("張辦");
  List list = new ArrayList();
  list.add(address);
  list.add(address2);
  JSONArray json = JSONArray.fromObject(list);
  log.info(json.toString());

3.JSONArray轉化為list

JSONObject jsonObject = JSONObject.fromObject("{\"no\":\"104\",\"provience\":\"陜西\",\"road\":\"高新路\",\"streate\":\"\"}");
  JSONArray jsonArray = new JSONArray();
  jsonArray.add("{\"no\":\"104\",\"provience\":\"陜西\",\"road\":\"高新路\",\"streate\":\"\"}");
  jsonArray.add("{\"no\":\"104\",\"provience\":\"陜西\",\"road\":\"高新路\",\"streate\":\"123\"}");
  Object object = JSONArray.toList(jsonArray,Address.class);

轉載:http://www.cnblogs.com/hitwtx/articles/2468633.html



一堣而安 2014-02-27 23:07 發表評論
]]>
jQuery data()http://www.aygfsteel.com/tinguo002/archive/2014/01/01/408340.html一堣而安一堣而安Wed, 01 Jan 2014 11:05:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/01/01/408340.htmlhttp://www.aygfsteel.com/tinguo002/comments/408340.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/01/01/408340.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/408340.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/408340.htmlhttp://jianfulove.iteye.com/blog/1842254

一堣而安 2014-01-01 19:05 發表評論
]]>
javascript深入學習http://www.aygfsteel.com/tinguo002/archive/2014/01/01/408336.html一堣而安一堣而安Wed, 01 Jan 2014 08:54:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2014/01/01/408336.htmlhttp://www.aygfsteel.com/tinguo002/comments/408336.htmlhttp://www.aygfsteel.com/tinguo002/archive/2014/01/01/408336.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/408336.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/408336.htmlhttp://www.laruence.com/2009/09/23/1089.html

一堣而安 2014-01-01 16:54 發表評論
]]>
用JS清除緩存(document.cookie)http://www.aygfsteel.com/tinguo002/archive/2013/12/11/407447.html一堣而安一堣而安Wed, 11 Dec 2013 06:34:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/11/407447.htmlhttp://www.aygfsteel.com/tinguo002/comments/407447.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/11/407447.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407447.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407447.html(轉)此文為轉載,實在不好意思,原文地址丟了沒有附上。

function foreach() {
 var strCookie = document.cookie;
 var arrCookie = strCookie.split("; "); // 將多cookie切割為多個名/值對
 for ( var i = 0; i < arrCookie.length; i++) { // 遍歷cookie數組,處理每個cookie對
  var arr = arrCookie[i].split("=");
  if (arr.length > 0)
   DelCookie(arr[0]);
 }

}
function GetCooki(offset)
{
 var endstr = document.cookie.indexOf(";", offset);
 if (endstr == -1)
  endstr = document.cookie.length;
 return decodeURIComponent(document.cookie.substring(offset, endstr));
}
function DelCookie(name) {
 var exp = new Date();
 exp.setTime(exp.getTime() - 1);
 var cval = GetCookie(name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString()+"; path=/"; //不斷的嘗試曾經使用過的path值
}

function GetCookie(name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
   return GetCooki(j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0)
   break;
 }
 return null;
}

另外推薦2個文章:

http://blog.sina.com.cn/s/blog_537cdd2e0100pxcz.html

http://www.mzone.cc/article/363.html


 



一堣而安 2013-12-11 14:34 發表評論
]]>
復選框文字對齊顯示 http://www.aygfsteel.com/tinguo002/archive/2013/12/08/407340.html一堣而安一堣而安Sun, 08 Dec 2013 13:48:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407340.htmlhttp://www.aygfsteel.com/tinguo002/comments/407340.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407340.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407340.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407340.html最近的工作中,有很多表單的制作,很多次都碰到復選框與文字對齊的問題,發現在不同的瀏覽器中,顯示各異,顯示效果如下

觀察發現,IE6、IE7 顯示效果基本相同,算是顯示比較正常的效果,IE8、safari 和火狐顯示效果基本相同,兩個文字都偏下,而opera稍偏下。在之前我的解決方法,都是通過文字外面套上另外的標簽,等,通過調整input標簽和label的html標簽來對齊,大概方法即是讓input 和label 標簽都左浮動,但前提一定是在寫頁面的時候,文字外面加了label 標簽,這種方法應為定義了大量的浮動,還需要清除浮動,才能保證下面頁面的正常顯示,或者有些人用相對定位等方法,如果文字外面沒有套label標簽,更沒有其他標簽呢?經過查找,發現其實還是有很簡單的方法就能解決問題

方法一:如果將font-family中的第一個字體設置為Tahoma,則可以實現對齊(Verdana等字體也可以)。次方法來源與 藍色理想 http://www.blueidea.com/tech/web/2009/6910_3.asp

 

 

如果文字外面有label 標簽,只要定義input,label {vertical-align:middle} 即可,

注意:因為單選框或是復選框有外邊距,所以需要先去除掉他的外邊距。

方法二: 定義input 標簽vertical-align  屬性,調整input 的上下邊距,來實現input和文字的水平對齊

.admin_more  input{vertical-align: text-bottom; margin-bottom:2px; *margin-bottom:-2px;}

原文:

http://blog.csdn.net/lifen_zhang/article/details/5415768

一堣而安 2013-12-08 21:48 發表評論
]]>
IE9瀏覽器中的My97日歷控件刷新后無法打開問題解決辦法 http://www.aygfsteel.com/tinguo002/archive/2013/12/08/407339.html一堣而安一堣而安Sun, 08 Dec 2013 13:47:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407339.htmlhttp://www.aygfsteel.com/tinguo002/comments/407339.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407339.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407339.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407339.html在IE9瀏覽器中有一個iframe框架,有一個頁面有my97日歷控件,為什么刷新這個頁面my97就不彈出日歷了!剛開始網上說是沒有用最新的代碼,最后換成最新的還是不行。盡快一天的時間終于找到答案。解決辦法如下:

     在WdatePicker.js配置文件,里面有個$crossFrame,默認是true改為問題$crossFrame:false就解決了。希望對大家有幫助!


     官方對此字段的解釋是 是否跨框架,一般設置為true即可,遇到跨域錯誤時可以將此功能關閉。


原文:http://blog.163.com/johns_cena/blog/static/16802644020132153190125/

一堣而安 2013-12-08 21:47 發表評論
]]>
jQuery 插件設置cookiehttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407338.html一堣而安一堣而安Sun, 08 Dec 2013 13:46:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407338.htmlhttp://www.aygfsteel.com/tinguo002/comments/407338.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/08/407338.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407338.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407338.html

jquery.cookie.js使用介紹

2011-04-21

對cookies的操作在當訪問一個網站就無時無刻的都伴隨著我們,記錄著我們的一舉一動,并將不危害用戶隱私的信息,將以保存,這樣用戶就不用去從新再次操作重復的步驟,這樣大大方便了客戶,也增加了客戶對網站的回頭率。

jquery.cookie.js 提供了jquery中非常簡單的操作cookie的方法。

  • $.cookie('the_cookie'); // 獲得cookie
  • $.cookie('the_cookie', 'the_value'); // 設置cookie
  • $.cookie('the_cookie', 'the_value', { expires: 7 }); //設置帶時間的cookie
  • $.cookie('the_cookie', '', { expires: -1 }); // 刪除
  • $.cookie('the_cookie', null); // 刪除 cookie
  • $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});//新建一個cookie 包括有效期 路徑 域名等

這個插件默認的過期是按天數計算的,我們可以修改下,按毫秒計算,修改如下:

1if (typeof options.expires === 'number') {
2    //var days = options.expires, t = options.expires = new Date();
3    //t.setDate(t.getDate() + days);
4    var seconds = options.expires, t = options.expires = new Date();
5    t.setTime(t.getTime() + seconds);
6    //t.setTime(t.getTime() + days);
7    //date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
8}

下面舉個簡單的例子:我們需要對某個頁面進行閱讀統計,但是呢,在一段時間里(比如5分鐘),同一個人無論刷新了這個頁面多少次都好,都只能算一次。這個時候可以借助cookie來實現:

01<script language="javascript" src="></script>
02<script type="text/javascript" src="></script>
03<script language="javascript" src="></script>
04<script type="text/javascript">
05    // 頁面類型,標識一組頁面
06    var pageType = 20110420;
07    // 頁面id,標識唯一一個頁面
08    var url = window.location.href;
09    var url_arr = url.split(".");
10    var id = url_arr[url_arr.length - 2];
11    //var id = 2;
12    //var cookie = $.cookie('the_cookie'+id, true, { expires: 5/24/60/60 });
13       
14    $(document).ready(function(){
15        init_count(pageType, id);
16    })
17       
18    // 初始化數據,同一個cookie一分鐘的訪問量都算一次
19    function init_count(pageType, id){
20        if($.cookie('the_cookie'+id)){
21            //alert("cookie已存在");
22            getViewData(pageType, id);
23        }
24        else
25        {
26            // 1分鐘過期
27            var cookie = $.cookie('the_cookie'+id, 'Gonn', { expires: 1000 * 60 * 5 });
28            //$.cookie('the_cookie'+id, 'Gonn');
29            //var cookie = $.cookie('the_cookie'+id);
30            //alert(cookie);
31            insert_page(pageType, id);
32           
33        }
34    }
35   
36    // 不插入與更新時統計訪問量
37    function getViewData(pageType, id){
38        $.ajax({ 
39            type: "get",        //使用get方法訪問后臺 
40            dataType: "jsonp"//返回json格式的數據 
41            jsonp:"callback",
42            url: ", //要訪問的后臺地址 
43            data:{"opp":"view", "pageType":pageType, "id":id},
44            async: false,
45            success: function(data){ 
46                //alert(data.total);
47                $('#pc_1').html(data.total);
48                $('#pcm_1').html(data.record);
49           
50        }) 
51    }
52   
53    // 插入或者更新頁面統計
54    function insert_page(pageType, id){
55        var j = null;
56        $.ajax({ 
57            type: "get",        //使用get方法訪問后臺 
58            dataType: "jsonp"//返回json格式的數據 
59            jsonp:"callback",
60            url: ", //要訪問的后臺地址 
61            data:{"opp":"insert", "pageType":pageType, "id":id},
62            async: false,
63            success: function(data){ 
64                //alert(msg.current);
65                //alert(msg.record);
66                j = data;
67                //alert("111");
68                //alert(j.total);
69                $('#pc_1').html(data.total);
70                $('#pcm_1').html(data.record);
71           
72        }) 
73    }
74
75</script>

代碼就直接原汁原味地貼上來吧,做個記錄。

原文:http://www.nowamagic.net/jquery/jquery_JqueryCookie.php



一堣而安 2013-12-08 21:46 發表評論
]]>
幾號字對應幾磅http://www.aygfsteel.com/tinguo002/archive/2013/12/06/407284.html一堣而安一堣而安Fri, 06 Dec 2013 03:39:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/06/407284.htmlhttp://www.aygfsteel.com/tinguo002/comments/407284.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/06/407284.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407284.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407284.html小初  36   12.70
一號  26   9.17
小一  24   8.47
二號  22   7.76
小二  18   6.35
三號  16搜索   5.64
小三  15   5.29
四號  14   4.94
小四  12   4.32
五號  10.5  3.70
小五  9    3.18
六號  7.5   2.65
小六  6.5   2.29====中文Windows 98為了滿足中文出版中使用字號作為字體大小的單位的需要,它允許用戶同時使用“號”和 “磅”作為字體大小的單位。提供的字號包括:八號、七號、小六、六號、小五、五號、小四、四號、小三、三號、小二、二號、小一、一號、小初、初號。表1列出了每一種字體的“號”對應的“磅”值。
  表1 “號”與“磅”的對應關系
  字號碼 磅值 字號 磅值
原文:
http://zhidao.baidu.com/link?url=zrjI9Vs3hTUYYvqbmviQGrdq_CNx4zzVSOi8CycKN4yI9RuwTbfBVm8fS4cAWaZ47f4BQMSGYP2SSWV2PDhXEq


一堣而安 2013-12-06 11:39 發表評論
]]>
div+css中如何讓圖片垂直居中顯示http://www.aygfsteel.com/tinguo002/archive/2013/12/01/407066.html一堣而安一堣而安Sun, 01 Dec 2013 08:30:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/12/01/407066.htmlhttp://www.aygfsteel.com/tinguo002/comments/407066.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/12/01/407066.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/407066.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/407066.htmlhttp://zhidao.baidu.com/link?url=9J7uz4M0AvCgH42DXICuke9dMxsKfmwgGIJcVpmyjZh-sltTqP2zLiWi7mPedyWR0yyqhkgZ_BjoaYhqooyR6q


放圖片的容器設置行高,給圖片設置屬性absmiddle,但是你說你的圖片不知道高度,所以你的容器高度也應該是不定吧?如果是這樣,也就是你容器的行高是不定的,這種方法也不好。
建議適時使用表格,DIV+CSS設計不是非要全盤都用DIV布局,適時而動才是王道,靈活應用。
<div style="line-height:200px"><img src="" align="absmiddle"搜索 /></div>
<table><tr><td valign="middle"><img src="" /></td><td></td></tr></table>

一堣而安 2013-12-01 16:30 發表評論
]]>
My97日期控件 時間前后限制http://www.aygfsteel.com/tinguo002/archive/2013/11/21/406627.html一堣而安一堣而安Thu, 21 Nov 2013 05:50:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/11/21/406627.htmlhttp://www.aygfsteel.com/tinguo002/comments/406627.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/11/21/406627.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/406627.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/406627.html      <input id="d4312" class="Wdate" type="text" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d4311\')}',maxDate:'2020-10-01'})"/>

一堣而安 2013-11-21 13:50 發表評論
]]>
如何利用js取得eWebEditor編輯器的內容 http://www.aygfsteel.com/tinguo002/archive/2013/11/20/406601.html一堣而安一堣而安Wed, 20 Nov 2013 13:31:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/11/20/406601.htmlhttp://www.aygfsteel.com/tinguo002/comments/406601.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/11/20/406601.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/406601.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/406601.htmlhttp://blog.csdn.net/sunyujia/article/details/2572861

用javascript取控件的值本來是一件簡單的事卻被eWebEditor搞的很不方便,導致很多初學者,不知道該如何獲取。在分析之前先把我們習慣性的取值方法寫出來。
<HTML>

<HEAD>

<TITLE>eWebEditor : 標準調用示例</TITLE>

<META http-equiv=Content-Type content="text/html; charset=gb2312">

<link rel='stylesheet' type='text/css' href='example.css'>

<script>

    
function validateForm(){


        
if(document.getElementById("content1").value!=""){

            document.getElementById(
"myform").submit();

        }
else{

            alert(
"");

        }


    }


</script>

</HEAD>

<BODY>

<FORM method="post" name="myform" action="rs.jsp">

<TABLE border="0" cellpadding="2" cellspacing="1">

<TR>

    
<TD>編輯內容:</TD>

    
<TD>

        
<INPUT type="hidden" name="content1" >

        
<IFRAME ID="eWebEditor1" src="../ewebeditor.htm?id=content1&style=coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>

    
</TD>

</TR>

<TR>

    
<TD colspan=2 align=right>

    
<INPUT type=button value="提交" onclick="validateForm()"> 

    
<INPUT type=reset value="重填"> 

    
<INPUT type=button value="查看源文件" onclick="location.replace('view-source:'+location)"> 

    
</TD>

</TR>

</TABLE>

</FORM>

</BODY>

</HTML>

上面代碼非常簡單我們一般會認為document.getElementById("content1").value這樣就可以取值了,但事實上并不是這樣,通過這種方式取值,只能取到初始值,當編輯器的內容變化時是取不到的,為什么呢?為什么后臺程序可以取得到編輯器中的值呢,<%=request.getParameter("content1")%>這里是可以取到編輯器中的內容的,但是document.getElementById("content1").value確不可以。看來eWebEditor在js中動了手腳,一定是動態幫定了提交事件,或動態綁定了在源碼中搜索onsubmit找到如下代碼,原來動態的綁定了onsubmit事件,這樣每次在提交前會執行AttachSubmit函數

    oForm.attachEvent("onsubmit", AttachSubmit) ;

    if (! oForm.submitEditor) oForm.submitEditor = new Array() ;

    oForm.submitEditor[oForm.submitEditor.length] = AttachSubmit ;

    if (! oForm.originalSubmit) {

        oForm.originalSubmit = oForm.submit ;

        oForm.submit = function() {

            if (this.submitEditor) {

                for (var i = 0 ; i < this.submitEditor.length ; i++) {

                    this.submitEditor[i]() ;

                }

            }

            this.originalSubmit() ;

        }

    }



 

function AttachSubmit() {

    var oForm = oLinkField.form ;

    if (!oForm) {return;}

   

    var html = getHTML();

    ContentEdit.value = html;

    if (sCurrMode=="TEXT"){

        html = HTMLEncode(html);

    }

    splitTextField(oLinkField, html);

}

 

 

AttachSubmit就是copy編輯器的內容到隱藏域控件中的過程。

知道了過程我們的問題就不難解決了。只需在取編輯器內容之前執行下AttachSubmit即可



 function validateForm(){

     window.frames["eWebEditor1"].AttachSubmit();//執行iframe頁面中的AttachSubmit函數

  if(document.getElementById("content1").value!=""){

   document.getElementById("myform").submit();

  }else{

   alert("空");

  }

 }


 整個過程就此結束,其實eWebEditor代碼中的很多思想都是很具有參考價值的例如AttachSubmit的綁定submit 方法的重新封裝,我還發現一段比較寫的比較好的代碼也一起貼出來。

var URLParams = new Object() ;

var aParams = document.location.search.substr(1).split('&') ;

for (i=0 ; i < aParams.length ; i++) {

 var aParam = aParams[i].split('=') ;

 URLParams[aParam[0]] = aParam[1] ;

}

 

var sLinkFieldName = URLParams["id"] ;

var sExtCSS = URLParams["extcss"] ;

var sFullScreen = URLParams["fullscreen"];

 

var config = new Object() ;

config.StyleName = (URLParams["style"]) ? URLParams["style"].toLowerCase() : "coolblue";

config.CusDir = URLParams["cusdir"];

config.ServerExt = "jsp";



解析url的方法,這種方法以前koko跟我說過一回,今天在ewebeditor中又看到了,看來是一種比較常規的分析URL參數的方法。

總結:其實eWebEditor只是修改了提交表單的兩個事件,在提交表單前進行值copy,從而避免了編輯器每次更新都同步值這種沒有必要的操作。





一堣而安 2013-11-20 21:31 發表評論
]]>
query取得iframe中元素的幾種方法http://www.aygfsteel.com/tinguo002/archive/2013/11/20/406600.html一堣而安一堣而安Wed, 20 Nov 2013 13:28:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/11/20/406600.htmlhttp://www.aygfsteel.com/tinguo002/comments/406600.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/11/20/406600.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/406600.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/406600.html原文:http://blog.csdn.net/zalion/article/details/5894103

 $(function(){
  var win = document.getElementById('jhjj_iframe').contentWindow;
     alert( win.document.body.innerText );
 });


在iframe子頁面獲取父頁面元素
代碼如下:

$('#objId', parent.document);
// 搞定...



一堣而安 2013-11-20 21:28 發表評論
]]>
解決在IE瀏覽器中JQuery.resize()執行多次的方法(轉)http://www.aygfsteel.com/tinguo002/archive/2013/11/07/406095.html一堣而安一堣而安Thu, 07 Nov 2013 05:54:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/11/07/406095.htmlhttp://www.aygfsteel.com/tinguo002/comments/406095.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/11/07/406095.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/406095.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/406095.htmlhttp://blog.sina.com.cn/s/blog_8034a5a40101bejr.html

最近在做前臺效果的時候用到了JQuery提供的resize()事件。resize
這個事件是監聽瀏覽器窗口的放大與縮小,也就是說瀏覽器窗口大小的變化。


    我在W3CSCHOOL上面查閱的時候,提供了一個例子。W3C源碼



  1. <</SPAN>html>

  2. <</SPAN>head>

  3. <</SPAN>script type="text/javascript" src="/jquery/jquery.js"></</SPAN>script>

  4. <</SPAN>script type="text/javascript">

  5. x=0;

  6. $(document).ready(function(){

  7. $(window).resize(function() {

  8. $("span").text(x+=1);

  9. });

  10. $("button").click(function(){

  11. $(window).resize();

  12. });

  13. });

  14. </</SPAN>script>

  15. </</SPAN>head>

  16. <</SPAN>body>

  17. <</SPAN>p>窗口的大小被調整了 <</SPAN>span>0</</SPAN>span> 次。</</SPAN>p>

  18. <</SPAN>p>請試著調整瀏覽器窗口的大小。</</SPAN>p>

  19. <</SPAN>button>觸發窗口的 resize 事件</</SPAN>button>

  20. </</SPAN>body>

  21. </</SPAN>html>
 結果我在IE環境下放大窗口 resize 事件執行了兩次。后來我在谷歌和百度上面查詢了下, 都存在IE環境下執行兩次的相關信息。最后發現一個很不錯的解決方案。 國外有個哥子寫了個插件專門針對Jquery.resize()事件增強了。 地址在這里:http://benalman.com/projects/jquery-resize-plugin/ 在添加jquery.js之后在添加 "jquery.ba-resize.js" 就可以了。  
 


  1. <</SPAN>html>

  2. <</SPAN>title>JQuery - resize()</</SPAN>title>

  3. <</SPAN>head>

  4. <</SPAN>script type="text/javascript" src="js/jquery.js"></</SPAN>script>

  5. <</SPAN>script type="text/javascript" src="js/jquery.ba-resize.js"></</SPAN>script>

  6. <</SPAN>script type="text/javascript">

  7. x=0;

  8. $(document).ready(function(){

  9. $(window).resize(function() {


  10. $("span").text(x+=1);

  11. });



  12. });

  13. </</SPAN>script>

  14. </</SPAN>head>

  15. <</SPAN>body>

  16. <</SPAN>p>窗口大小被調整過 <</SPAN>span>0</</SPAN>span> 次。</</SPAN>p>

  17. <</SPAN>p>請試著重新調整瀏覽器窗口的大小。</</SPAN>p>

  18. </</SPAN>body>

  19. </</SPAN>html>


一堣而安 2013-11-07 13:54 發表評論
]]>
JS取整http://www.aygfsteel.com/tinguo002/archive/2013/10/30/405799.html一堣而安一堣而安Wed, 30 Oct 2013 06:29:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/10/30/405799.htmlhttp://www.aygfsteel.com/tinguo002/comments/405799.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/10/30/405799.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/405799.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/405799.html1.丟棄小數部分,保留整數部分

js:parseInt(7/2)

2.向上取整,有小數就整數部分加1

js: Math.ceil(7/2)

3,四舍五入.
js: Math.round(7/2)

4,向下取整

js: Math.floor(7/2)
詳細出處參考:http://www.jb51.net/article/23398.htm



一堣而安 2013-10-30 14:29 發表評論
]]>
js數字驗證http://www.aygfsteel.com/tinguo002/archive/2013/10/30/405797.html一堣而安一堣而安Wed, 30 Oct 2013 06:26:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/10/30/405797.htmlhttp://www.aygfsteel.com/tinguo002/comments/405797.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/10/30/405797.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/405797.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/405797.htmlhttp://lives.iteye.com/blog/1397939地


<script type="text/javascript">
     function validate(){
       var reg = new RegExp("^[0-9]*$");
       var obj = document.getElementById("name");
    if(!reg.test(obj.value)){
        alert("請輸入數字!");
    }
    if(!/^[0-9]*$/.test(obj.value)){
        alert("請輸入數字!");
    }
  }
< /script>

驗證數字的正則表達式集
驗證數字:^[0-9]*$
驗證n位的數字:^\d{n}$
驗證至少n位數字:^\d{n,}$
驗證m-n位的數字:^\d{m,n}$
驗證零和非零開頭的數字:^(0|[1-9][0-9]*)$
驗證有兩位小數的正實數:^[0-9]+(.[0-9]{2})?$
驗證有1-3位小數的正實數:^[0-9]+(.[0-9]{1,3})?$
驗證非零的正整數:^\+?[1-9][0-9]*$
驗證非零的負整數:^\-[1-9][0-9]*$
驗證非負整數(正整數 + 0) ^\d+$
驗證非正整數(負整數 + 0) ^((-\d+)|(0+))$
驗證長度為3的字符:^.{3}$
驗證由26個英文字母組成的字符串:^[A-Za-z]+$
驗證由26個大寫英文字母組成的字符串:^[A-Z]+$
驗證由26個小寫英文字母組成的字符串:^[a-z]+$
驗證由數字和26個英文字母組成的字符串:^[A-Za-z0-9]+$
驗證由數字、26個英文字母或者下劃線組成的字符串:^\w+$
驗證用戶密碼:^[a-zA-Z]\w{5,17}$ 正確格式為:以字母開頭,長度在6-18之間,只能包含字符、數字和下劃線。
驗證是否含有 ^%&',;=?$\" 等字符:[^%&',;=?$\x22]+
驗證漢字:^[\u4e00-\u9fa5],{0,}$
驗證Email地址:^\w+[-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
驗證InternetURL:^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$ ;^[a-zA-z]+://(w+(-w+)*)(.(w+(-w+)*))*(?S*)?$
驗證電話號碼:^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$:--正確格式為:XXXX-XXXXXXX,XXXX-XXXXXXXX,XXX-XXXXXXX,XXX-XXXXXXXX,XXXXXXX,XXXXXXXX。
驗證身份證號(15位或18位數字):^\d{15}|\d{}18$
驗證一年的12個月:^(0?[1-9]|1[0-2])$ 正確格式為:“01”-“09”和“1”“12”
驗證一個月的31天:^((0?[1-9])|((1|2)[0-9])|30|31)$ 正確格式為:01、09和1、31。
整數:^-?\d+$
非負浮點數(正浮點數 + 0):^\d+(\.\d+)?$
正浮點數 ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
非正浮點數(負浮點數 + 0) ^((-\d+(\.\d+)?)|(0+(\.0+)?))$
負浮點數 ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
浮點數 ^(-?\d+)(\.\d+)?$




一堣而安 2013-10-30 14:26 發表評論
]]>
js 獲取一個對象中的所有屬性 http://www.aygfsteel.com/tinguo002/archive/2013/10/29/405752.html一堣而安一堣而安Tue, 29 Oct 2013 03:36:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/10/29/405752.htmlhttp://www.aygfsteel.com/tinguo002/comments/405752.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/10/29/405752.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/405752.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/405752.html來源:http://blog.163.com/rodger_yuan/blog/static/4977376020101271013298/
function inst()
{
    
this.attr1=1;
    
this.attr2="attr2";
}


var newInst=new inst();
for(var attr in newInst)
{
    alert(
"inst的"+attr+"屬性:"+newInst[attr]);
}

通過for...in...遍歷一個對象實例的所有屬性,只有基本類型的屬性值會顯示出來,如果一個對象的屬性是object則提示的是此屬性的類型,可以使用嵌套的for...in...語句實現完全遍歷。



一堣而安 2013-10-29 11:36 發表評論
]]>
JS中實現replaceAll的方法 http://www.aygfsteel.com/tinguo002/archive/2013/10/11/404881.html一堣而安一堣而安Fri, 11 Oct 2013 11:55:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/10/11/404881.htmlhttp://www.aygfsteel.com/tinguo002/comments/404881.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/10/11/404881.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/404881.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/404881.html原文:
http://fuleonardo.iteye.com/blog/339749

第一次發現JavaScript中replace() 方法如果直接用str.replace("-","!") 只會替換第一個匹配的字符.
而str.replace(/\-/g,"!")則可以全部替換掉匹配的字符(g為全局標志)。

replace()
The replace() method returns the string that results when you replace text matching its first argument
(a regular expression) with the text of the second argument (a string).
If the g (global) flag is not set in the regular expression declaration, this method replaces only the first
occurrence of the pattern. For example,

var s = "Hello. Regexps are fun.";s = s.replace(/\./, "!"); // replace first period with an exclamation pointalert(s);

produces the string “Hello! Regexps are fun.” Including the g flag will cause the interpreter to
perform a global replace, finding and replacing every matching substring. For example,

var s = "Hello. Regexps are fun.";s = s.replace(/\./g, "!"); // replace all periods with exclamation pointsalert(s);

yields this result: “Hello! Regexps are fun!”

所以可以用以下幾種方式.:
string.replace(/reallyDo/g, replaceWith);
string.replace(new RegExp(reallyDo, 'g'), replaceWith);

string:字符串表達式包含要替代的子字符串。
reallyDo:被搜索的子字符串。
replaceWith:用于替換的子字符串。

 

<script type="text/javascript">
String.prototype.replaceAll 
= function(reallyDo, replaceWith, ignoreCase) {
    
if (!RegExp.prototype.isPrototypeOf(reallyDo)) {
        
return this.replace(new RegExp(reallyDo, (ignoreCase ? "gi""g")), replaceWith);
    }
 else {
        
return this.replace(reallyDo, replaceWith);
    }

}

</script>



 



一堣而安 2013-10-11 19:55 發表評論
]]>
HTML dtd信息http://www.aygfsteel.com/tinguo002/archive/2013/07/19/401757.html一堣而安一堣而安Fri, 19 Jul 2013 07:29:00 GMThttp://www.aygfsteel.com/tinguo002/archive/2013/07/19/401757.htmlhttp://www.aygfsteel.com/tinguo002/comments/401757.htmlhttp://www.aygfsteel.com/tinguo002/archive/2013/07/19/401757.html#Feedback0http://www.aygfsteel.com/tinguo002/comments/commentRss/401757.htmlhttp://www.aygfsteel.com/tinguo002/services/trackbacks/401757.html 


http://blog.chinaunix.net/uid-22414998-id-2892370.html



http://www.jb51.net/web/36856.html

定義和用法

<!DOCTYPE> 聲明位于文檔中的最前面的位置,處于 <html> 標簽之前。此標簽可告知瀏覽器文檔使用哪種 HTML 或 XHTML 規范。

該標簽可聲明三種 DTD 類型,分別表示嚴格版本、過渡版本以及基于框架的 HTML 文檔。

以下面這個 <!DOCTYPE> 標簽為例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

在上面的聲明中,聲明了文檔的根元素是 html,它在公共標識符被定義為 "-//W3C//DTD XHTML 1.0 Strict//EN" 的 DTD 中進行了定義。瀏覽器將明白如何尋找匹配此公共標識符的 DTD。如果找不到,瀏覽器將使用公共標識符后面的 URL 作為尋找 DTD 的位置。



一堣而安 2013-07-19 15:29 發表評論
]]>
主站蜘蛛池模板: 新密市| 车致| 荥阳市| 祁东县| 牟定县| 吉水县| 孟村| 大足县| 常山县| 大竹县| 泌阳县| 香港 | 莱州市| 花垣县| 黄大仙区| 北海市| 土默特右旗| 玛曲县| 凤台县| 临邑县| 阿坝县| 景泰县| 宿迁市| 抚顺市| 怀来县| 临猗县| 连南| 东乡| 山阳县| 苍溪县| 高安市| 社会| 丹江口市| 江阴市| 长兴县| 郧西县| 鸡泽县| 长垣县| 秦皇岛市| 汶川县| 九龙县|