<script> var keleyijson={"plug1":"myslider","plug2":"zonemenu","plug3":"keleyi"} function JSONLength(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(key)) size++; } return size; }; document.write("json對象的元素個數是:"+JSONLength(keleyijson)); </script>