DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> javascript import include 導入數據類型判斷函數
javascript import include 導入數據類型判斷函數
編輯:JavaScript綜合知識     

   代碼如下:

  function isAlien(a)

  {

  return isObject(a) && typeof a.constructor != 'function';

  }

  function isArray(a)

  {

  return isObject(a) && a.constructor == Array;

  }

  function isBoolean(a)

  {

  return typeof a == 'boolean';

  }

  function isEmpty(o)

  {

  var i, v;

  if (isObject(o)) {

  for (i in o) {

  v = o[i];

  if (isUndefined(v) && isFunction(v)) {

  return false;

  }

  }

  }

  return true;

  }

  function isFunction(a)

  {

  return typeof a == 'function';

  }

  function isNull(a)

  {

  return typeof a == 'object' && !a;

  }

  function isNumber(a)

  {

  return typeof a == 'number' && isFinite(a);

  }

  function isObject(a)

  {

  return (a && typeof a == 'object') || isFunction(a);

  }

  function isString(a)

  {

  return typeof a == 'string';

  }

  function isUndefined(a)

  {

  return typeof a == 'undefined';

  }

  function $import(path,type,title)

  {

  var s,i;

  if(type=="js")

  {

  var ss=document.getElementsByTagName("script");

  for(i=0;i

  {

  if(ss[i].src && ss[i].src.indexOf(path)!=-1)return;

  }

  s=document.createElement("script");

  s.type="text/javascript";

  s.src=path;

  }

  else if(type=="css")

  {

  var ls=document.getElementsByTagName("link");

  for(i=0;i

  {

  if(ls[i].href && ls[i].href.indexOf(path)!=-1)return;

  }

  s=document.createElement("link");

  s.rel="alternate stylesheet";

  s.type="text/css";

  s.href=path;

  s.title=title;

  s.disabled=false;

  }

  else return;

  var head=document.getElementsByTagName("head")[0];

  head.appendChild(s);

  }

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved