1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="bflib.xsl"?>
<ref name="DOM2" description="Document Object Model (DOM) Level 2 Gecko" version="2">
<note title="source">http://developer.mozilla.org/en/docs/Gecko_DOM_Reference</note>
<note title="copyright">the content is available primarily under the terms of the Creative Commons: Attribution-Sharealike license. Code samples are available under the terms of the MIT License.
</note>
<note title="status">completed 2006-01-02T16:13:31+0100
to be verified
falsetti@clansco.org
http://bluefish.clansco.org/ref/bflib_dom.xml
</note>
<element kind="var" name="getElementById()">
<description>Returns the element whose ID is specified.
Syntax: element = document.getElementById(id);
Implementations that do not know whether attributes are of type ID or not are expected to return null.
getElementById was introduced in DOM Level 2.
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-getElBId</description>
<properties>
<property kind="parameter" name="id" />
</properties>
</element>
<element kind="var" name="style">
<properties>
<property kind="parameter" name="id" />
<property kind="parameter" name="style" > <values>,visibility,zIndex,accelerator,azimuth,background,backgroundAttachment,backgroundColor,backgroundImage,backgroundPosition,
backgroundRepeat,border,borderBottom,borderBottomColor,borderBottomStyle,borderBottomWidth,borderCollapse,
borderColor,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRight,borderRightColor,
borderRightStyle,borderRightWidth,borderSpacing,borderStyle,borderTop,borderTopColor,borderTopStyle,
borderTopWidth,borderWidth,bottom,captionSide,clear,clip,color,content,counterIncrement,counterReset,cssFloat,
cssText,cue,cueAfter,onBefore,cursor,direction,displays,elevation,emptyCells,font,fontFamily,fontSize,fontSizeAdjust,
fontStretch,fontStyle,fontVariant,fontWeight,height,left,length,letterSpacing,lineHeight,listStyle,listStyleImage,
listStylePosition,listStyleType,margin,marginBottom,marginLeft,marginRight,marginTop,markerOffset,marks,maxHeight,
maxWidth,minHeight,minWidth,MozBinding,MozOpacity,orphans,outline,outlineColor,outlineStyle,outlineWidth,
overflow,padding,paddingBottom,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,
pageBreakInside,parentRule,pause,pauseAfter,pauseBefore,pitch,pitchRange,playDuring,position,quotes,richness,right,
size,speak,speakHeader,speakNumeral,speakPunctuation,speechRate,stress,tableLayout,textAlign,textDecoration,
textIndent,textShadow,textTransform,top,unicodeBidi,verticalAlign,visibility,voiceFamily,volume,whiteSpace,widows,
width,wordSpacing,zIndex </values>
</property>
</properties>
</element>
<group name="window">
<note title="Introduction">This chapter provides a brief reference for all of the methods, properties, and events available through the DOM window object. The window object implements the Window interface, which in turn inherits from the AbstractView interface.
The window object represents the window itself. Typically, window contains the document as a child (see DOM document Reference), provides access to the window.navigator and window.screen objects for manipulating the browsing environment itself, and provides a number of special properties for accessing the object model below it.
In a tabbed browser, such as Firefox, each tab contains its own window object. That is, the window object is not shared between tabs in the same window. There are exceptions to this, namely the window.resizeTo and window.resizeBy methods. Generally, anything that can't reasonably pertain to a tab pertains to the window instead. </note>
<group name="Properties">
<element kind="var" name="window.content and window._content">
<description>Returns a reference to the content element in the current window. The variant with underscore is deprecated</description>
</element>
<element kind="var" name="window.closed">
<note title="Specification">DOM Level 0. window.closed is not part of any W3C specification or technical recommendation.</note>
<note title="Additional Reference">MSDN window.closed http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/closed.asp</note>
<description>This property indicates whether the current window is closed or not</description>
<properties>
<property kind="example">
<description><![CDATA[ Loading a page into the main window from a popup
The following example demonstrates how a popup window can pass user's choice to the main window by opening there a different URL. It has to be checked first whether the main window is still open.
if (!window.opener.closed) {
<span class="remark">// The window that opened us is still around,
// let's go to another page there!</span>
window.opener.location.href = newURL;
}
Calling a function in a previously opened popup
In this example the function refreshPopupWindow() calls a function in a popup window to refresh its data. However, if the popup window hasn't been opened yet or the user closed it already a new window is opened.
var popupWindow = null;
function refreshPopupWindow() {
if (popupWindow && !popupWindow.closed) {
<span class="remark">// We already opened a popup window and it is
// still open! We will call its function doRefresh() then.</span>
popupWindow.doRefresh();
} else {
<span class="remark">// have to open the popup window first</span>
popupWindow = window.open("popup.html");
}
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.Components">
<note title=""> Mozilla/Netscape only, </note>
<note title="Specification">DOM Level 0. Not part of specification.</note>
<description>Returns an array of the XPCOM components installed in the Gecko browser</description>
<properties>
<property kind="link">
<description><![CDATA[http://developer.mozilla.org/en/docs/DOM:window.Components
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.controllers">
<description>Returns the XUL controller objects for the current chrome window</description>
</element>
<element kind="var" name="window.crypto">
<note title="">Returns the browser crypto object, which can then be used to manipulate various browser security features.
See JavaScript crypto http://developer.mozilla.org/en/docs/JavaScript_crypto for details. </note>
<note title="Specification">DOM Level 0. Not part of specification.</note>
<description>Returns the browser crypto object</description>
</element>
<element kind="var" name="window.defaultStatus">
<note title="">To set the status once the window has been opened, use window.status.</note>
<note title="Specification">DOM Level 0. Not part of specification.</note>
<description>Gets/sets the status bar text for the given window</description>
<properties>
<property kind="example">
<description><![CDATA[<html>
<body onload="window.defaultStatus='hello!';"/>
<button onclick="window.confirm('Are you sure you want to quit?');">confirm</button>
</body>
</htm>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.directories">
<note title="">Gecko only</note>
<note title="Specification">DOM Level 0. Not part of specification.
Syntax : dirBar = window.directories
Parameters : dirBar is an object of the type barProp. </note>
<description>Returns a reference to the directories toolbar in the current chrome</description>
<properties>
<property kind="example">
<description><![CDATA[<script>
function dirs() {
alert(window.directories);
}
</script>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.document">
<note title=""></note>
<note title="Specification">DOM Level 0. Not part of specification.</note>
<description>Returns a reference to the document that the window contains
Syntax : doc = window.document
Parameters : doc is an object reference to a document. </description>
<properties>
<property kind="example">
<description><![CDATA[doc= window.document;
window.dump(doc.title);
// prints the current document's title to the console.
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.frames">
<description>Returns an array of the subframes in the current window.
Syntax: frameList = window.frames;
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[var frames = window.frames;
for (var i = 0; i < frames.length; i++) {
// do something with each subframe as frames[i]
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.history">
<description>Returns a reference to the history object, which provides an interface for manipulating the browser history.
Syntax: historyObj = window.history
Parameters: historyObject is an object reference.
The history object provides the following interface: current, length, next, previous, back(), forward(), go().
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
h = window.history;
if ( h.length ) { // if there is a history
h.back(); // equivalent to clicking back button
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.innerHeight">
<description>Height of the browser window viewport including, if rendered, the horizontal scrollbar.
Syntax: var intViewportHeight = window.innerHeight;
Value: intViewportHeight stores the window.innerHeight property value.
The window.innerHeight property is read-only; it has no default value. window.innerHeight property stores an integer representing a number of pixels.
The innerHeight property will be supported in any window object like a window,
a frame, a frameset or a secondary window.
DOM Level 0. Not part of any W3C technical specification or recommendation.</description>
<properties>
<property kind="example">
<description><![CDATA[ Assuming a frameset
var intFrameHeight = window.innerHeight; // or
var intFrameHeight = self.innerHeight; /* will return the height of the
frame viewport within the frameset */
var intFramesetHeight = parent.innerHeight; /* will return the height of
the viewport of the closest frameset */
var intOuterFramesetHeight = top.innerHeight; /* will return the height
of the viewport of the outermost frameset */
See also window.innerWidth, window.outerHeight and window.outerWidth. ]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.innerWidth">
<description>Width of the browser window viewport including, if rendered, the vertical scrollbar.
Syntax: var intViewportWidth = window.innerWidth;
Value: intViewportWidth stores the window.innerWidth property value.
The window.innerWidth property is read-only; it has no default value.
window.innerWidth property stores an integer representing a number of pixels.
The innerWidth property does not include the sidebar.
So when the sidebar is expanded, the innerWidth property value diminishes.
The innerWidth property will be supported in any window object like a window,
a frame, a frameset or a secondary window.
DOM Level 0. Not part of any W3C technical specification or recommendation.</description>
<properties>
<property kind="example">
<description><![CDATA[Assuming a frameset
var intFrameWidth = window.innerWidth; // or
var intFrameWidth = self.innerWidth; /* will return the width of the
frame viewport within the frameset */
var intFramesetWidth = parent.innerWidth; /* will return the width of
the viewport of the closest frameset */
var intOuterFramesetWidth = top.innerWidth; /* will return the width
of the viewport of the outermost frameset */
See also window.outerWidth, window.innerHeight and window.outerHeight. ]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.length">
<description>Returns the number of frames in the window.
Syntax: ifrms = window.length
Parameters: ifrms is the number of frames as an integer.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if ( window.length )
// this is a document with subframes
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.location">
<description>Gets/sets the location, or current URL, of the window object.
Syntax: url = window.location window.location = url
Parameters: url is a string containing the URL for the specified location.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function getNews() {
window.location= "http://www.cnn.com";
}
// in html: <button onclick="getNews();">News</button>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.locationbar">
<description>Returns the locationbar object, whose visibility can be toggled in the window.
Syntax: objRef = window.locationbar
When you load the example page above, the browser displays the following dialog: Image:window.locationbar example dialog.png To toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above. Also be aware that dynamically updating the visibilty of the various toolbars can change the size of the window rather dramatically, and may affect the layout of your page. See also: window.locationbar, window.menubar, window.personalbar, window.scrollbars, window.statusbar, window.toolbar
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserWrite");
window.locationbar.visible= !window.locationbar.visible;
</script>
</head>
<body>
<p>Various DOM Tests</p>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.menubar">
<description>Returns the menubar object, whose visibility can be toggled in the window.
Syntax: objRef = window.menubar
When you load the example page above, the browser displays the following dialog:
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserWrite");
window.menubar.visible=!window.menubar.visible;
</script>
</head>
<body>
<p>Various DOM Tests</p>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.name">
<description>Gets/sets the name of the window.
Syntax: string = window.name window.name = string
The name of the window is used primarily for setting targets for hyperlinks and forms. Windows do not need to have names.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.name = "lab_view";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator">
<description>Returns a reference to the navigator object.
Syntax: nav = window.navigator
Parameters: nav is a navigator object reference.
The navigator object is used to examine the actual browser being used. It includes properties for getting information about the browser itself. All of the properties and methods available from window.navigator can also be referenced simply with navigator.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
nav = window.navigator;
if ( nav.language != en ) {
res = window.confirm(lang_warn);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.appCodeName">
<description>Returns the internal "code" name of the current browser.
Syntax: codeName = window.navigator.appCodeName
Parameters: codeName is the internal name of the browser as a string.
Mozilla, Netscape 6, and IE5 all use the internal name "Mozilla."
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
dump(window.navigator.appCodeName);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.appName">
<description>Returns the official name of the browser.
Syntax: appName = window.navigator.appName
Parameters: appName is the name of the browser as a string.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
dump(window.navigator.appName);
// prints "Navigator"; to the console for NS6
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.appVersion">
<description>Returns the version of the browser as a string.
Syntax: ver = window.navigator.appVersion
Parameters: ver is the version number of the browser as a string.
The window.navigator.userAgent property also contains the version number (example: "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape 6/6.1"), but you should be aware of how easy it is to change the user agent string and "spoof" other browsers, platforms, or user agents, and also how cavalier the browser vendor themselves are with these properties. The window.navigator.appVersion and window.navigator.userAgent properties are quite often used in "browser sniffing" code: scripts that attempt to find out what kind of browser you are using and adjust pages accordingly.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if ( navigator.appVersion.charAt(0) == "5" ) {
// browser is putatively a v5 browser
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.cookieEnabled">
<description>Returns a boolean value indicating whether cookies are enabled or not.
Syntax: res = window.navigator.cookieEnabled
Parameters: res is a boolean True or False.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if (window.navigator.cookieEnabled) {
// set a cookie
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.language">
<description>Returns a string representing the language version of the browser.
Syntax: lang = window.navigator.language
Parameters: lang is a two character string (e.g., "en" or "ja") representing the language version.
This property also shows up as part of the navigator.userAgent string.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if ( window.navigator.language != "en") {
doLangSelect(window.navigator.language);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.mimeTypes">
<description>Returns a list of the MIME types supported by the browser
DOM Level 0. Not part of specification.</description>
</element>
<element kind="var" name="window.navigator.oscpu">
<description>Returns a string that identifies the current operating system.
Syntax: oscpuInfo = window.navigator.oscpu
Parameters: oscpu is a string that takes the following form.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function osInfo() {
alert(window.navigator.oscpu);
}
// returns: Win98
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.platform">
<description>Returns a string representing the platform of the browser.
Syntax: plat = window.navigator.platform
Parameters: plat is a string with one of the following values:
Win95 Windows 95 WinNT Windows NT MacPPC Macintosh PowerPC SunOS Solaris ....
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function osInfo() {
alert(window.navigator.platform);
}
// returns: win32
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.plugins">
<description>Returns an array of the plugins installed in the browser.
Syntax: plugins = window.navigator.plugins
Parameters: plugins is an array of plugin objects.
The plugin objecct exposes a small interface for getting information about the various plugins installed in your browser.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function pluginInfo() {
alert(window.navigator.plugins.item(0).name);
}
// returns "Shockwave for Director"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.product">
<description>This property returns the product name of the current browser.
Syntax: productName = window.navigator.product
Parameters: productName is a string.
product is that portion of the full user agent string that comes directly after the platform. In the user agent for Netscape 6.1, for example, the product is "Gecko" and the full agent string is the following: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<script>
function prod() {
dt = document.getElementById("d").childNodes[0];
dt.data = window.navigator.userAgent;
}
</script>
<button onclick="prod();">product</button>
<div id="d"> </div>
// returns "Gecko"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.productSub">
<description>productSub returns the build number of the current browser.
Syntax: prodSub = window.navigator.productSub
Parameters: prodSub is a string.
On IE, this property returns undefined.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<script>
function prodsub() {
dt = document.getElementById("d").childNodes[0];
dt.data = window.navigator.productSub;
}
</script>
<button onclick="prodsub();">productSub</button>
// returns: 20010725
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.userAgent">
<description>Returns the user agent string for the current browser.
Syntax: var <var>strUserAgent</var> = window.navigator.userAgent;
strUserAgent stores the user agent string value of the current browser.
The window.navigator.userAgent property is read-write; it has no default value.
The user agent string is built on a formal structure which can be decomposed into several pieces of info.
Each of these pieces of info comes from other navigator properties which are also settable by the user.
Gecko-based browsers comply with the following general structure:
userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU;
Localization; rv: revision-version-number) product/productSub
Application-Name Application-Name-version
Browser identification based on detecting the user agent string is unreliable and not recommendable.
navigator.userAgent is an user configurable string. For example:
* Mozilla 1.x and Firefox 1.x can use the preference
"general.useragent.override" in about:config. Some Firefox
extensions or multi-bar do that.
* Opera 6+ allows users to set the browser identification string
via a menu
* MS Internet Explorer uses the Windows registry
* Safari and ICab allow users to change the browser user agent
string to predefined Internet Explorer or Netscape strings via a menu.
DOM Level 0. Not part of any W3C technical specification or recommendation.</description>
<properties>
<property kind="example">
<description><![CDATA[
window.navigator.userAgent
// returns Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.vendor">
<description>Returns the name of the browser vendor for the current browser.
Syntax: venString = window.navigator.vendor
Parameters: venString is a string.
vendor is another portion of the userAgent string. The product and the vendor can be different--as when Netscape 6.1 uses the Gecko product to do its rendering. See also navigator.product, navigator.userAgent
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
window.navigator.vendor
// returns "Netscape6"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.vendorSub">
<description>vendorSub is the substring of the vendor having to do with the vendor version number.
Syntax: venSub = window.navigator.vendorSub
Parameters: venSub is a string.
vendorSub is yet another component of the full user agent string. It refers to the version number that the vendor themselves have given the current browser (as opposed to the version of the product, which may be different). In Netscape 6.1, the productSub is given as "5.0" and the vendorSub is "6.1." See also navigator.productSub, navigator.userAgent, navigator.vendor
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
window.navigator.vendorSub
// returns "6.1" where the vendor part of userAgent is
// Netscape6/6.1
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.opener">
<description>Returns a reference to the window that opened this current window.
Syntax: objRef = window.opener
When a window is opened from another window, it maintains a reference to that first window as window.opener. If the current window has no opener, this method returns NULL.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if window.opener != indexWin {
referToTop(window.opener);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.outerHeight">
<description>Gets the height of the outside of the browser window. window.outerHeight represents the height of the whole browser window including toolbars and window chrome.
Syntax: var intWindowHeight = window.outerHeight;
Value: intWindowHeight stores the window.outerHeight property value.
The window.outerHeight property is read-only; it has no default value.
window.outerHeight property stores an integer representing a number of pixels.
See also window.innerHeight, window.innerWidth and window.outerWidth
DOM Level 0. Not part of any W3C technical specification or recommendation.</description>
</element>
<element kind="var" name="window.outerWidth">
<description>Gets the width of the outside of the browser window. window.outerWidth represents the width of the whole browser window including sidebar (if expanded), window chrome and window [re-]sizing borders/handles.
Syntax: var intWindowWidth = window.outerWidth;
Value: intWindowWidth stores the window.outerWidth property value.
The window.outerWidth property is read-only; it has no default value.
window.outerWidth property stores an integer representing a number of pixels.
See also window.innerHeight, window.innerWidth and window.outerHeight.
DOM Level 0. Not part of any W3C technical specification or recommendation.
</description>
</element>
<element kind="var" name="window.pageXOffset">
<description>Gets the amount of content that has been hidden by scrolling to the right.
Syntax: hScroll = window.pageXOffset
Parameters: hScroll is the number of pixels scrolled as an integer.
If the user has scrolled to the right and 200 pixels of the content is hidden by this, then the window.pageXOffset property returns 200. See also: window.pageYOffset
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
var hScroll = window.pageXOffset;
var vScroll = window.pageYOffset;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.pageYOffset">
<description>Gets the amount of content that has been hidden by scrolling down.
Syntax: vScroll = window.pageYOffset
Parameters: vScroll is the number of pixels as an integer.
If the user has scrolled down and 400 pixels of the content is hidden by this, then the window.pageYOffset property returns 400. See also window.pageXOffset
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
var hScroll = pageXOffset;
var vScroll = pageYOffset;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.parent">
<description>Returns a reference to the parent of the current window or subframe.
Syntax: objRef = window.parent
If a window does not have a parent, its parent property is a reference to itself.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if (window.parent != window.top)
// we're deeper than one down
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.personalbar">
<description>Returns the personalbar object, whose visibility can be toggled in the window.
Syntax: objRef = window.menubar
To toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above. Also be aware that dynamically updating the visibilty of the various toolbars can change the size of the window rather dramatically, and may affect the layout of your page. See also: window.locationbar, window.menubar, window.scrollbars, window.statusbar, window.toolbar
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserWrite");
window.personalbar.visible= !window.personalbar.visible;
</script>
</head>
<body>
<p>Various DOM Tests</p>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.pkcs11">
<description>Returns the pkcs11 object , which can be used to install drivers and other software associated with the pkcs11 protocol.
Syntax: objRef = window.pkcs11
See nsIDOMPkcs11 for more information about how to manipulate pkcs11 objects.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
window.pkcs11.addModule(sMod, secPath, 0, 0);
]]></description>
</property>
</properties>
<note title=""></note>
</element>
<element kind="var" name="window.prompter">
<description>Returns a reference to an nsIPrompt instance, allowing to show dialogs parented to the current window.
Syntax: objRef = window.prompter
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.prompter.alert("Dialog Title", "This is the text of a dialog")
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen">
<description>Returns a reference to the screen object associated with the window.
Syntax: screenObj = window.screen
The screen object is a special JavaScript object for controlling aspects of the screen on which the current
window is being rendered. screen object properties such as colorDepth, height, and availHeight can be
accessed from the window object by using properties like window.screen.colorDepth and others described below.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[s = window.screen;
if ( s.colorDepth < 8) {
// use low-color version of page
} else {
// use regular, colorful page
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.availHeight">
<description>Returns the amount of vertical space available to the window on the screen.
Syntax: iAvail = window.screen.availHeight
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if window.screen.availHeight != window.screen.height {
// something's in the way!
// use available to size window
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screenavailLeft">
<description>Syntax: iAvail = window.screen.availLeft
In most cases, this property returns 0.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[setY = window.screen.height - window.screen.availTop;
setX = window.screen.width - window.screen.availLeft;
window.moveTo(setX, setY);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.availTop">
<description>Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.
Syntax: iAvail = window.screen.availTop
In most cases, this property returns 0.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[setY = window.screen.height - window.screen.availTop;
setX = window.screen.width - window.screen.availLeft;
window.moveTo(setX, setY);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.availWidth">
<description>Returns the amount of horizontal space in pixels available to the window.
Syntax: iAvail = window.screen.availWidth
no notes
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="window.screen.colorDepth">
<description>Returns the color depth of the screen.
Syntax: bitDepth = window.screen.colorDepth
See also window.screen.pixelDepth.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// check the color depth of the screen
if ( window.screen.colorDepth < 8) {
// use low-color version of page
} else {
// use regular, colorful page
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.height">
<description>Returns the height of the screen in pixels.
Syntax: iHeight = window.screen.height
Note that not all of the height given by this property may be available to the window itself. Widgets such as taskbars or other special application windows that integrate with the OS (e.g., the Spinner player minimized to act like an additional toolbar on windows) may reduce the amount of space available to browser windows and other applications.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if (window.screen.availHeight != window.screen.height) {
// something is occupying some screen real estate!
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.left">
<description>Gets/sets the current distance in pixels from the left side of the screen.
Syntax: lLeft = window.screen.left window.screen.left = lLeft
See also window.screen.top.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// move and resize the current window
window.resizeTo(window.screen.availWidth/2);
window.screen.left = 1;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.pixelDepth">
<description>Returns the bit depth of the screen.
Syntax: depth = window.screen.pixelDepth
See also window.screen.colorDepth.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// if there is not adequate bit depth
// choose a simpler color
if ( window.screen.pixelDepth > 8 ) {
document.style.color = "#FAEBD7";
} else {
document.style.color = "#FFFFFF";
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.top">
<description>Gets/sets the distance from the top of the screen.
Syntax: lTop = window.screen.top window.screen.top = lTop
See also window.screen.left.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// move and resize the current window,
// making it like a bar across the top
window.resizeTo( window.screen.availHeight/4 );
window.screen.top = 0;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screen.width">
<description>Returns the width of the screen.
Syntax: lWidth = window.screen.width
Note that not all of the width given by this property may be available to the window itself. When other widgets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availWidth. See also window.screen.height.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// crude way to check that the screen is at 1024x768
if (window.screen.width > 1000) {
// resolution is below 10 x 7
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.screenX">
<description>Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
Syntax: lLoc = window.screenX
Parameters: lLoc is the number of pixels from the left side the screen.
See also window.screenY.
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="window.screenY">
<description>Returns the vertical distance of the top border of the user's browser from the top side of the screen.
Syntax: lLoc = window.screenY
Parameters: lLoc is the number of pixels from the top of the screen.
See also window.screenX.
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="window.scrollbars">
<description>Returns the scrollbars object, whose visibility can be toggled in the window.
Syntax: objRef = window.scrollbars
Note that scrollbars is not an array of the scrollbars. The visibility of these objects can only be controlled as
a group. To toggle the visibility of these bars, you must either sign your scripts or enable the appropriate
privileges, as in the example above. Also be aware that dynamically updating the visibilty of the various
toolbars can change the size of the window rather dramatically, and may affect the layout of your page.
See also: window.locationbar, window.menubar, window.personalbar, window.statusbar, window.toolbar
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserWrite");
window.menubar.visible=!window.menubar.visible;
</script>
</head>
<body>
<p>Various DOM Tests</p>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollX">
<description>Returns the number of pixels that the document has already been scrolled horizontally.
Syntax: xpix = window.scrollX
Parameters: xpix is the number of pixels.
Use this property to check that the document hasn't already been scrolled some if you are using relative scroll functions such as window.scrollBy, window.scrollByLines, or window.scrollByPages.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// make sure and go over to the second horizontal page
if (window.scrollX) {
scroll(0,0); }
scrollBy(400, 0);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollY">
<description>Returns the number of pixels that the document has already been scrolled vertically.
Syntax: ypix = window.scrollY
Parameters: ypix is the number of pixels.
Use this property to check that the document hasn't already been scrolled some if you are using relative scroll functions such as window.scrollBy, window.scrollByLines, or window.scrollByPages
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// make sure and go down to the second page
if (window.scrollY) {
scroll(0,0); }
scrollByPages(1);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.self">
<description>Returns an object reference to the window object.
Syntax: objRef = window.self
window.self is almost always used in comparisons like in the example above, which finds out if the current window is the first subframe in the parent frameset.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if (window.parent.frames[0] != window.self) {
// this window is not the first frame in the list
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.sidebar">
<description>Returns a reference to the window object of the sidebar.
Syntax: sidebar = window.sidebar
Parameters: sidebar is a window object.
The sidebar is a subframe in the DOM of the application window. Its content can be accessed with sidebar._content, as in the foregoing example, and it is a sibling of the window's main content frame.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[sbar = window.sidebar;
if (sbar) {
sbar_content = sbar._content;
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.status">
<description>Gets/sets the text in the statusbar at the bottom of the browser.
Syntax: string = window.status window.status = string
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[while ( bigLoad ) {
window.status = "Loading...";
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.statusbar">
<description>Returns the statusbar object, whose visibility can be toggled in the window.
Syntax: objRef = window.menubar
When you load the example page above, the browser displays the following dialog:
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserWrite");
window.statusbar.visible=!window.statusbar.visible;
</script>
</head>
<body>
<p>Various DOM Tests</p>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.toolbar">
<description>Returns the toolbar object, whose visibility can be toggled in the window.
Syntax: objRef = window.menubar
To toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges,
as in the example above. Also be aware that dynamically updating the visibilty of the various toolbars can
change the size of the window rather dramatically, and may affect the layout of your page.
See also: window.locationbar, window.menubar, window.personalbar, window.scrollbars, window.statusbar
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<html>
<head>
<title>Various DOM Tests</title>
<script>
// changing bar states on the existing window
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
window.toolbar.visible=!window.toolbar.visible;
</script>
</head>
<body>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.top">
<description>Returns a reference to the topmost window in the window hierarchy.
Syntax: objRef = window.top
Where the window.parent property returns the immediate parent of the current window, window.top
returns the topmost window in the hierarchy of window objects.
This property is especially useful when you are dealing with a window that is in a subframe
of a parent or parents, and you want to get to the top-level frameset.
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="window.window">
<description><![CDATA[The window property of a window object points to the window object itself. Thus the following expressions all return the same window object:
window.window
window.window.window
window.window.window.window
...
In web pages, the window object is also a global object. This means that:
1. global variables of your script are in fact properties of window:
var global = {data: 0};
alert(global === window.global); // displays "true"
2. that you can access built-in properties of the window object without having to type window. prefix:
setTimeout("alert('Hi!')", 50); // equivalent to using window.setTimeout.
alert(window === window.window); // displays "true"
The point of having the window property refer to the object itself was (probably) to make it easy to refer to the global object (otherwise you'd have to do a manual var window = this; assignment at the top of your script).
Another reason is that without this property you wouldn't be able to write, for example, "window.open('http://google.com/')" - you'd have to just use "open('http://google.com/')" instead. ]]></description>
</element>
</group>
<group name="Methods">
<element kind="var" name="window.alert()">
<description>Display an alert dialog with the specified text.
Syntax: window.alert(text)
Parameters: text is a string of the text you want displayed in the alert dialog.
The alert dialog should be used for messages which do not require any response of the part of the user, other than the acknowledgement of the message.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.alert("I'm a Scorpio!");]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.atob()">
<description></description>
</element>
<element kind="var" name="window.back()">
<description>Returns the window to the previous item in the history.
Syntax: window.back()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[function goBack() {
if ( canGoBack )
window.back();
}]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.blur()">
<description>Shifts focus away from the window.
Syntax: window.blur()
The window.blur() method is the programmatic equivalent of the user shifting focus away from the current window.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.blur();]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.btoa()">
<description></description>
</element>
<element kind="var" name="window.captureEvents()">
<description>Registers the window to capture all events of the specified type.
Syntax: window.captureEvents(Event.eventType)
Parameters: eventType is a string with one of the following values: Abort, Blur, Click, Change, DblClick, DragDrop, Error, Focus, KeyDown, KeyPress, KeyUp, Load, MouseDown, MouseMove, MouseOut, MouseOver, MouseUp, Move, Reset, Resize, Select, Submit, Unload.
Events raised in the DOM by user activity (such as clicking buttons or shifting focus away from the current document) generally pass through the high-level window and document objects first before arriving at the object that initiated the event.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<html>
<script>
function reg() {
window.captureEvents(Event.CLICK);
window.onclick = hit;
}
function hit() {
alert('hit');
}
</script>
<body onload="reg();">
<button>test</button>
<div id="d"> </div>
</body>
</html>]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.clearInterval()">
<description>Clears a delay that's been set for a specific function.
Syntax: window.clearInterval(intervalID)
Parameters: intervalID is the ID of the specific interval you want to clear, which is the return value of a call to the setInterval method.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.clearInterval(animID);]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.clearTimeout()">
<description>Clears the delay set by window.setTimeout().
Syntax: window.clearTimeout(timeoutID)
Passing an invalid ID to clearTimeout does not have any effect (and doesn't throw an exception).
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[var alarm = {
remind: function(aMessage) {
alert(aMessage);
delete this.timeoutID;
},
setup: function() {
this.cancel();
var self = this;
this.timeoutID = window.setTimeout(function(msg) {self.remind(msg);}, 1000, "Wake up!");
},
cancel: function() {
if(typeof this.timeoutID == "number") {
window.clearTimeout(this.timeoutID);
delete this.timeoutID;
}
}
};
window.onclick = function() { alarm.setup() };]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.close()">
<description>Closes the referenced window.
Syntax: window.close();
DOM Level 0. window.close() is not part of any W3C specification or technical recommendation. </description>
</element>
<element kind="var" name="window.confirm()">
<description>Displays a dialog with a message that the user needs to respond to.
Syntax: result = window.confirm(text)
Parameters: text is a string. result is a boolean value indicating whether OK or Cancel was selected.
Unlike the alert dialog, which contains only an OK button, a confirm dialog has OK and Cancel buttons, and returns true only when the user confirms the choice being presented by clicking OK. The return value of window.confirm() is often tested as part of a conditional block, as in the example above.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if (window.confirm("Want to see my mood ring?")) {
window.open("mood.html", "mood ring", "");
}]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.dump()">
<description>Prints messages to the console.
Syntax: window.dump(text)
Parameters: text is a string.
window.dump is commonly used to debug JavaScript.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[doc = window.document;
window.dump(doc.title);
// prints the current document's title to the console.]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.escape()">
<description>Encodes a string.
Syntax: sEscaped = window.escape(sRegular)
Parameters: sEscaped is the endoded string. sRegular is a regular string
The escape() method converts special characters (any characters that are not regular text or numbers) into hexadecimal characters, which is especially necessary for setting the values of cookies.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[alert(escape("http://www.cnn.com")); // displays: http%3Awww.cnn.com]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.focus()">
<description>Sets focus on the window.
Syntax: window.focus()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if (clicked) { window.focus(); }]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.forward()">
<description>Moves the window one document forward in the history.
Syntax: window.forward()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[function goForward() { if ( canGoForward) window.forward(); }
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.getAttention()">
<description>Flashes the application icon to get the user's attention.
Syntax: window.getAttention()
On windows and linux, the icon flashes in the system tray. On macintosh, the icon in the upper right corner of the desktop flashes.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// from Chatzilla
function notifyAttention (source)
{
if (typeof source != "object")
source = client.viewsArray[source].source;
if (client.currentObject != source)
{
var tb = dispatch("create-tab-for-view", { view: source });
var vk = Number(tb.getAttribute("viewKey"));
tb.setAttribute ("state", "attention");
client.activityList[vk] = "!";
updateTitle();
}
if (client.prefs["notify.aggressive"])
window.getAttention();
}]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.getSelection()">
<description>Returns a selection object representing the selected item(s).
Syntax: selection = window.getSelection()
Parameters: selection is a Selection object.
In JavaScript, when a selection object is passed to a function, a string representation of it (i.e. the selected text) is passed instead. This makes the selection object appear like a string, when it is really an object with its own properties and methods. Specifically, the return value of calling the DOM:Selection:toString method of the Selection object is passed. In the above example, selObj is automatically "converted" when passed to window.alert. However, to use a JavaScript String property or method such as length or substr, you must manually call the toString method.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[function foo() {
var selObj = window.getSelection();
alert(selObj);
var selRange = selObj.getRangeAt(0);
// do stuff with the range
}]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.home()">
<description>Returns the window to the home page.
Syntax: window.home()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function goHome() {
window.home();
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.moveBy()">
<description>Moves the current window by a specified amount.
Syntax: window.moveBy(deltaX, deltaY)
Parameters: deltaX is the amount of pixels to move the window horizontally. deltaY is the amount of pixels to move the window vertically.
You can use negative numbers as parameters for this function. This function makes a relative move while window.moveTo makes an absolute move.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function budge() {
moveBy(10, -10);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.moveTo()">
<description>Moves the window to the specified coordinates.
Syntax: window.moveTo(x, y)
Parameters: x is the horizontal coordinate to be moved to. y is the vertical coordinate to be moved to.
This function moves the window absolutely while window.moveBy moves the window relative to its current location.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function origin() {
// moves to top left corner of screen
window.moveTo(0, 0)
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.navigator.javaEnabled()">
<description>This method indicates whether the current browser is Java-enabled or not.
Syntax: result = window.navigator.javaEnabled()
The return value for this method indicates whether the preference that controls Java is on or off - not whether the browser offers Java support in general.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[if (window.navigator.javaEnabled()) {
// browser has java
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.open()">
<description>Creates a new secondary browser window and loads the referenced resource.
Syntax: WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);
Return value and parameters:
WindowObjectReference
This is the reference pointing to the newly created browser window.
This reference is the return value of the open() method;
it will be null if for some reasons the call didn't succeed to open the window.
A global variable is best used to store such reference.
You can then, for example, use it to look for properties of the new window or access its methods,
assuming that your main versus secondary window relationship complies with
Same origin policy security requirements.
strUrl
This is the URL to be loaded in the newly opened window.
strUrl can be an HTML document on the web,
it can be an image file or any type of file which is supported by the browser.
strWindowName
This is the string that just names the new window.
Such string can be used to be the target of links and forms when the target attribute
of an <a> element or of a <form> is specified.
This string parameter should not contain any blank space.
strWindowName does not specify the title of the new window.
strWindowFeatures
Optional parameter.
This parameter is the string which lists the requested window features
(window functionalities and toolbars) of the new browser window.
This string parameter must not contain any blank space.
Each requested window feature must be separated by a comma inside the character string.
Description:
The open() method creates a new secondary browser window,
similar to choosing New Window from the File menu.
The strUrl parameter specifies the URL to be fetched and loaded in the new window.
If strUrl is an empty string, then a new blank, empty window (URL about:blank loaded)
is created with the default toolbars of the main window.
Note that remote URLs won't load immediately.
When window.open() returns, the window always contains about:blank.
The actual fetching of the URL is deferred and starts after the current script block finishes executing.
The window creation and the loading of the referenced resource are done asynchronously.
DOM Level 0. window.open() is not part of any W3C specification or technical recommendation. </description>
<properties>
<property kind="example">
<description><![CDATA[<script type="text/javascript">
var WindowObjectReference;
/* Declaring a global variable which will store
a reference to the new window to be created */
function openRequestedPopup()
{
WindowObjectReference = window.open("http://www.cnn.com/", "CNN_WindowName",
"menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
}
</script>
<script type="text/javascript">
var WindowObjectReference; // global variable
function openRequestedPopup()
{
WindowObjectReference = window.open("http://www.domainname.ext/path/ImageFile.png",
"DescriptiveWindowName",
"resizable=yes,scrollbars=yes,status=yes");
}
</script>
If a window with the name strWindowName already exists, then, instead of opening a new window,
strUrl is loaded into the existing window. In this case the return value of the method is the existing window
and strWindowFeatures is ignored. Providing an empty string for strUrl is a way to get a reference to an
open window by its name without changing the window's location. If you want to open a new window on
every call of window.open(), you should use the special value _blank for strWindowName.
strWindowFeatures is an optional string containing a comma-separated list of requested features of the new
window. After a window is opened, you can not use JavaScript to change the window functionalities and the
window toolbars. If strWindowName does not specify an existing window and if you do not supply the
strWindowFeatures parameter (or if the strWindowFeatures parameter is an empty string), then the new
secondary window will render the default toolbars of the main window.
If the strWindowFeatures parameter is used and if no size features are defined, then the new window
dimensions will be the same as the dimensions of the most recently rendered window.
If the strWindowFeatures parameter is used and if no position features are defined, then the left and top
coordinates of the new window dimension will be 22 pixels off from where the most recently rendered
window was. An offset is universally implemented by browser manufacturers (it is 29 pixels in MSIE 6 SP2
with the default theme) and its purpose is to help users to notice new windows opening. If the most recently
used window was maximized, then there is no 22 pixels offset: the new, secondary window will be
maximized as well.
If you define the strWindowFeatures parameter, then the features that are not listed, requested in the string
will be disabled or removed (except titlebar and close which are by default yes).
Tip: If you use the strWindowFeatures parameter, then only list the features you want to include in the new
window, that you want to be enabled or rendered; the others (except titlebar and close) will be disabled, removed. ]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.openDialog()">
<description>Opens a new dialog window</description>
</element>
<element kind="var" name="window.print()">
<description>Prints the current document.
Syntax: window.print()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.print();]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.prompt()">
<description>Displays a dialog with a message that prompts the user for a text response.
Syntax: result = window.prompt(text)
Parameters: text is a string of the text to be displayed to the user. result is a string containing the text the user entered.
A prompt dialog contains a single-line textbox and an OK button, and returns the (possibly empty) text the user inputted into that textbox.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[var sign = prompt("What's your sign?");
if (sign.toLowerCase() == "scorpio") {
alert("Wow! I'm a Scorpio too!");
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.releaseEvents()">
<description>Releases the window from trapping events of a specific type.
Syntax: window.releaseEvents(eventType)
Parameters: eventType is a string with one of the following values:
Note that you can pass a list of events to this method using the following syntax: window.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP). Also note that the eventType parameter is case-insensitive, so you can also say, for example, window.releaseEvents(Event.KeyPress). See also window.captureEvents.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[ window.releaseEvents(Event.KEYPRESS)]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.resizeBy()">
<description>Resizes the current window by a certain amount.
Syntax: window.resizeBy(xDelta, yDelta)
Parameters: xDelta is the number of pixels to grow the window horizontally. yDelta is the number of pixels to grow the window vertically.
This method resizes the window relative to its current size. To resize the window in absolute terms, use window.resizeTo.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// shrink the window
window.resizeBy(-200, -200);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.resizeTo()">
<description>Dynamically resizes window.
Syntax: window.resizeTo(iWidth, iHeight)
Parameters: iWidth is an integer representing the new width in pixels. iHeight is an integer value representing the new height in pixels.
See also window.resizeBy.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// function resizes the window to take up half
// of the available screen.
function halve() {
window.resizeTo(window.screen.availWidth/2,
window.screen.availHeight/2);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scroll()">
<description>Scrolls the window to a particular place in the document.
Syntax: window.scroll(x-coord, y-coord)
Parameters: x-coord is the pixel along the horizontal axis of the document that you want displayed in the upper left. y-coord is the pixel along the vertical axis of the document that you want displayed in the upper left.
window.scrollTo is effectively the same as this method. For scrolling a particular distance repeatedly, use the window.scrollBy. Also see window.scrollByLines, window.scrollByPages.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// put the 1000th vertical pixel at
// the top of the window
<INPUT TYPE="button" VALUE="1000"
onClick="scroll(0, 1000);"/>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollBy()">
<description>Scrolls the document in the window by the given amount.
Syntax: window.scrollBy(xDelta, yDelta)
Parameters: xDelta is the amount of pixels to scroll horizontally. yDelta is the amount of pixels to scroll vertically.
window.scrollBy scrolls by a particular amount where window.scroll scrolls to an absolute position in the document. See also window.scrollByLines, window.scrollByPages
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// scroll one page
window.scrollBy(0, window.innerHeight);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollByLines()">
<description>Scrolls the document by the given number of lines.
Syntax: window.scrollByLines(lines)
Parameters: lines is the number of lines.
See also window.scrollBy, window.scrollByPages.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<button onclick="scrollByLines(10);">jump</button>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollByPages()">
<description>Scrolls the current document by the specified number of pages.
Syntax: window.scrollByPages(pages)
Parameters: pages is the number of pages to scroll.
See also window.scrollBy, window.scrollByLines, window.scroll, window.scrollTo.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// scroll one page
window.scrollByPages(1);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.scrollTo()">
<description>Scrolls to a particular set of coordinates in the document.
Syntax: window.scrollTo(x-coord, y-coord)
Parameters: x-coord is the pixel along the horizontal axis of the document that you want displayed in the upper left. y-coord is the pixel along the vertical axis of the document that you want displayed in the upper left.
This function is effectively the same as window.scroll. For relative scrolling, see window.scrollBy, window.scrollByLines, and window.scrollByPages.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
window.scrollTo(0, 1000);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.setInterval()">
<description>Set a delay for a specific function.
Syntax: ID = window.setInterval(funcName, delay)
Parameters: funcName is the name of the function for which you want to set a delay. delay is the number of milliseconds (thousandths of a second) that the function should be delayed. ID is the interval ID.
The interval ID is used to refer to the specific interval when it needs to be cleared. The window.setInterval function is commonly used to set a delay for functions that are executed again and again, such as animations. See also window.clearInterval.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[intervalID = window.setInterval("animalate()", 500);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.setTimeout()">
<description>Executes a code snippet or a function after specified delay.
Syntax: timeoutID = window.setTimeout(func, delay[, param1, param2, ...]); timeoutID = window.setTimeout(code, delay);
You can cancel the timeout using window.clearTimeout().
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.setTimeout('window.parent.generateOutput()', 1000);
function generateOutput(aConcise) {
if(aConcise)
parent.generateConciseOutput();
else
parent.generateOutput();
}
window.setTimeout(generateOutput, 1000, true);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.sizeToContent()">
<description>Sizes the window according to its content.
Syntax: window.sizeToContent()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.sizeToContent();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.stop()">
<description>This method stops window loading.
Syntax: window.stop()
The stop() method is exactly equivalent to clicking the stop button in the browser. Because of the order in which scripts are loaded, the stop() method cannot stop the document in which it is contained from loading, but it will stop the loading of large images, new windows, and other objects whose loading is deferred.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[window.stop();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.unescape()">
<description>Unencodes a value that has been encoded in hexadecimal (e.g., a cookie).
Syntax: window.unescape(sValue)
Parameters: sValue is an encoded string.
See also window.escape.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[cookieValuePlain = window.unescape( cookieValue );
]]></description>
</property>
</properties>
</element>
<element kind="var" name="window.updateCommands()">
<description>Updates the state of commands of the current chrome window (UI).
Syntax: window.updateCommands("sCommandName")
Parameters: sCommandName is a particular string which describes what kind of update event this is (e.g. whether we are in bold right now).
This enables or disables items (setting or clearing the "disabled" attribute on the command node as appropriate), or ensures that the command state reflects the state of the selection by setting current state information in the "state" attribute of the XUL command nodes.
DOM Level 0. Not part of specification. </description>
</element>
</group>
<group name="Event Handlers">
<element kind="var" name="window.onabort">
<description>abort events on the window</description>
</element>
<element kind="var" name="window.onblur">
<description>blur events on the window</description>
</element>
<element kind="var" name="window.onchange">
<description>change events on the window</description>
</element>
<element kind="var" name="window.onclick">
<description>click events on the window</description>
</element>
<element kind="var" name="window.onclose">
<description>handling the window close event</description>
</element>
<element kind="var" name="window.ondragdrop">
<description>drag and drop events on the window</description>
</element>
<element kind="var" name="window.onerror">
<description>errors raised on the window</description>
</element>
<element kind="var" name="window.onfocus">
<description>focus events on the window</description>
</element>
<element kind="var" name="window.onkeydown">
<description>keydown events on the window</description>
</element>
<element kind="var" name="window.onkeypress">
<description>keypress events on the window</description>
</element>
<element kind="var" name="window.onkeyup">
<description>keyup events on the window</description>
</element>
<element kind="var" name="window.onload">
<description>window loading</description>
</element>
<element kind="var" name="window.onmousedown">
<description>mousedown events on the window</description>
</element>
<element kind="var" name="window.onmousemove">
<description>mousemove events on the window</description>
</element>
<element kind="var" name="window.onmouseout">
<description>mouseout events on the window</description>
</element>
<element kind="var" name="window.onmouseover">
<description>mouseover events on the window</description>
</element>
<element kind="var" name="window.onmouseup">
<description>mouseup events on the window</description>
</element>
<element kind="var" name="window.onpaint">
<description>paint events on the window</description>
</element>
<element kind="var" name="window.onreset">
<description>reset events on the window</description>
</element>
<element kind="var" name="window.onresize">
<description>window resizing</description>
</element>
<element kind="var" name="window.onscroll">
<description>window scrolling</description>
</element>
<element kind="var" name="window.onselect">
<description>window selection</description>
</element>
<element kind="var" name="window.onsubmit">
<description>submits on window forms</description>
</element>
<element kind="var" name="window.onunload">
<description>unload events on the window</description>
</element>
</group>
</group>
<group name="document">
<note title="Introduction">In the DOM, the document object provides a general way to represent HTML, XHTML, and XML documents. Document objects implement the Document interface.
In addition to this generalized Document interface, the APIs listed here include HTMLDocument, which is a more specialized interface for dealing with HTML documents (e.g., document.cookie, document.alinkColor). Interfaces that are part of this more specialized HTML document have asterisks (*) next to them in the table below.
The document is contained by the window object (see window) and may contain any number of elements (see element).
As you can see from the lists below, the interfaces on document deal with such things as the document type, features of the document such as its color and formatting, the plugins and applets that are exposed to the user in the document, as well as methods for creating all of the document's child nodes, or elements that typically live in the structural representation of the whole document, such as the <BODY> element, a <TABLE> and so forth. </note>
<group name="Properties">
<element kind="var" name="document.alinkColor">
</element>
<element kind="var" name="document.anchors">
<description>anchors returns a list of all of the anchors in the document.
Syntax: nodeList = document.anchors
For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-7577272</description>
<properties>
<property kind="example">
<description><![CDATA[if ( document.anchors.length >= 5 ) {
dump("dump found too many anchors");
window.location = "http://www.getoutahere.com";
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.applets">
<description>applets returns an ordered list of the applets within a document.
Syntax: nodeList = document.applets
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-85113862</description>
<properties>
<property kind="example">
<description><![CDATA[// ( When you know the second applet is the one
// you want )
my_java_app = document.applets[1];
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.bgColor">
<description>bgColor gets/sets the background color of the current document.
Syntax: color = document.bgColor document.bgColor = color
Parameters: color is a string representing the color as a word (e.g., "red') or as an octal value, as in HTML (e.g., "#eee")
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[document.bgColor = "darkblue";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.body">
<description>body returns the BODY or FRAMESET node of the current document.
Syntax: objRef = document.body
document.body = objRef
body is the element that contains the content for the document. In documents with BODY contents, returns
the BODY element, and in frameset documents, this returns the outermost FRAMESET element. Though
body is settable, setting a new body on a document will effectively remove all the current children of the
existing BODY element.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-56360201</description>
<properties>
<property kind="example">
<description><![CDATA[// in HTML: <body id="oldBodyElement"></body>
alert(document.body.id); // "oldBodyElement"
var aNewBodyElement = document.createElement("body");
aNewBodyElement.id = "newBodyElement";
document.body = aNewBodyElement;
alert(document.body.id); // "newBodyElement"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.characterSet">
<description>Returns the character encoding of the current document. This is the character encoding used
for rendering the document, which may be different from the encoding specified by the page (the user can
override the encoding).
Syntax: string = document.characterSet
For a complete list of character sets, see: http://www.iana.org/assignments/character-sets.
DOM Level "0". Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<input
value="char"
type="button"
onclick="alert(document.characterSet);" />
// returns "ISO-8859-1"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.compatMode">
<description>Indicates whether the document is rendered in Quirks mode or Strict mode.
Syntax: mode = document.compatMode
Parameters: mode is a string containing "BackCompat" for Quirks mode or "CSS1Compat" for Strict mode.
mode is a string containing "BackCompat" for Quirks mode or "CSS1Compat" for Strict mode</description>
<properties>
<property kind="example">
<description><![CDATA[if ( document.compatMode == "BackCompat" ){
// use some quirky stuff
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.contentWindow">
<description>Returns the containing window of the current document.
Syntax: objRef = document.contentWindow
</description>
<properties>
<property kind="example">
<description><![CDATA[// get to the browser
// then load new content
browserWindow = document.contentWindow;
browserWindow.home();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.cookie">
<description>Gets/sets a list of the cookies associated with the current document.
Syntax: cookie_list = document.cookie document.cookie = cookie_list
Parameters: cookie_list is a string containing a semicolon-separated list of cookies.
If there are no cookies associated with a document, this function returns an empty string.
Note also that you cannot use this property to set more than one cookie at a time.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-8747038</description>
<properties>
<property kind="example">
<description><![CDATA[// this function sets two cookies and then
// displays them in an alert
function sgCookie() {
document.cookie = "name=oeschger";
document.cookie = "favorite_food=tripe";
alert(document.cookie);
}
// returns: name=oeschger;favorite_food=tripe
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.defaultView">
</element>
<element kind="var" name="document.doctype">
<description>Returns the Document Type Definition (DTD) of the current document.
Syntax: string = document.DocumentType
DocumentType attribute is a read-only property.
It returns NULL if there is no DTD for the current document.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A31
</description>
</element>
<element kind="var" name="document.documentElement">
<description>Returns the Element that is a direct child of document, which in most cases is the HTML element.
Syntax: node = document.documentElement
This property is a read-only convenience for getting the HTML element associated with all valid HTML documents.
The example above is quite typical: you actually want the HTML element so you can access all of its children,
and so you use this document property to get a hold of it.
Note that document itself typically contains a single child node,
HTML, which itself contains all of the elements in the actual HTML document as a nodeList of children.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-87CD092</description>
<properties>
<property kind="example">
<description><![CDATA[actual_doc = document.documentElement;
first_tier = actual_doc.childNodes;
// first_tier are the direct children of HTML
for (var i = 0; i < first_tier.length; i++) {
// do something with each kid of HTML
// as first_tier[i]
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.domain">
<description>domain gets/sets the domain of the current document.
Syntax: string = document.domain
document.domain = string
This property returns NULL if the server of the document cannot be identified.
In the DOM spec, this property is listed as being read-only, but Mozilla lets you set it.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-2250147</description>
<properties>
<property kind="example">
<description><![CDATA[bad_domain = "www.love.com";
if ( document.domain == bad_domain ) {
window.close();
}
// for document www.love.com/good.html,
// this script closes the window
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.embeds">
<description>embeds returns a list of the embedded OBJECTS within the current document.
Syntax: nodeList = document.embeds
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="document.fgColor">
<description>fgColor gets/sets the foreground color, or text color, of the current document.
Syntax: color = document.fgColor document.fgColor = color
Parameters: color is a string representing the color as a word (e.g., "red") or as an octal value, as in HTML (e.g., "#eee").
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[document.fgColor = "white";
document.bgColor = "darkblue";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.firstChild">
<description>document.firstChild returns the first node in the list of direct children of the document.
Syntax: child = document.firstChild
Parameters: child is a node of the type element.
Note that you may have to recurse into the DOM tree with this property to get the the child nodes you
expect, since HTML is almost always given as the first child of the document itself. This is simply the element
property firstChild, but the notes are different for the document.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-169727388</description>
<properties>
<property kind="example">
<description><![CDATA[
function fChild() {
f = document.firstChild;
alert(f.tagName);
}
// returns: HTML
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.forms">
<description>forms returns a list of the FORM elements within the current document.
Syntax: nodeList = document.forms
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-1689064</description>
<properties>
<property kind="example">
<description><![CDATA[<form id="marjoree"> <input
type="button"
onclick="alert(document.forms[0].id);"/>
</form>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.height">
<description>height gets/sets the height of the current document.
Syntax: height_value = document.height
document.height = height_value
Parameters: height_value is a string representing the height of the document in pixels, inches, or ems. If no type is specified (e.g., "px" in 200px), the value is assumed to be the number of pixels.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-91561496</description>
<properties>
<property kind="example">
<description><![CDATA[// make the window small on load
function onLoad() {
document.height = "200";
document.width = "200";
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.images">
<description>document.images returns a collection of the images in the current HTML document.
Syntax: htmlCollection = document.images
document.images is part of DOM HTML, and it only works for HTML documents.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-90379117</description>
<properties>
<property kind="example">
<description><![CDATA[var ilist = document.images;
for(var i = 0; i < ilist.length; i++) {
if(ilist[i] == "banner.gif") {
// found the banner
}
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.implementation">
<description>Returns the DOM implementation associated with the current document.
Syntax: DOMImplementationObj = document.DOMImplentation
If available, the DOMImplementation is a special object that provides services for controlling things outside
of a single document. For example, the DOMImplementation interface includes a createDocumentType
method with which DTDs can be created for one or more documents managed by the implementation.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-90379117</description>
</element>
<element kind="var" name="document.lastModified">
<description>Returns the date and time on which the current document was last modified.
Syntax: string = document.lastModified
Note that as a string, lastModified cannot easily be used for comparisions between the modified dates of documents.</description>
<properties>
<property kind="example">
<description><![CDATA[dump(document.lastModified);
// returns: Tuesday, July 10, 2001 10:19:42
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.linkColor">
<description>linkcolor gets/sets the color of links within the document.
Syntax: color = document.linkColor document.linkColor = color
Parameters: color is a string representing the color as a word (e.g., "red') or as an octal value, as in HTML (e.g., "#eee")
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[document.linkColor = "blue";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.links">
<description>The links property returns a collection of all AREA elements and anchor elements in a document with a value for the href attribute.
Syntax: nodeList = document.links
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-7068919</description>
<properties>
<property kind="example">
<description><![CDATA[var links = document.links;
for(var i = 0; i < links.length; i++) {
var linkHref = document.createTextNode(links[i].href);
var lineBreak = document.createElement("br");
document.body.appendChild(linkHref);
document.body.appendChild(lineBreak);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.location">
<description>Gets the URL of the current document.
Syntax: string = document.location
document.location works the same as document.URL. Both are read-only properties unlike window.location, which can be set. Since the document object represents a single document or URL, its location cannot be changed.
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[dump(document.location);
// returns a string like
// http://www.peoplemagazine.com/juicybits.html
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.namespaceURI">
<description>namespaceURI returns the XML namespace for the current document.
Syntax: NSURI = document.namespaceURI
Parameters: NSURI is a string containing the namespace.
The DOM does not handle or enforce namespace validation per se. It is up to the DOM application to do any validation necessary.
Note too that the namespace prefix, once it is associated with a particular node, cannot be changed.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#Namespaces-Considerations</description>
</element>
<element kind="var" name="document.plugins">
<description>Returns a list of the plugins currently installed.
Syntax: PluginArrayObj = document.plugins
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[<script TYPE="text/javascript">
</script>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.referrer">
<description>Returns the URI of the page that linked to this page.
Syntax: string = document.referrer
The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).
Note that since this property returns only a string it does not give you DOM access to the referring page.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-95229140</description>
</element>
<element kind="var" name="document.styleSheets">
<description>The styleSheets property returns a list of the stylesheet objects on the current document.
Syntax: nodeList = document.styleSheets
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="document.title">
<description>document.title returns the title of the document.
Syntax: sTitle = document.title
Parameters: sTitle is a string that contains the title of the current document.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-18446827</description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<title>Hello World!</title>
<body>
...
// document.title returns "Hello World!"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.URL">
<description>Returns the URL of the current document.
Syntax: string = document.URL
URL is a replacement for the DOM Level 0 document.location.href property.
However document.URL is not settable, unlike document.location.href.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-46183437</description>
<properties>
<property kind="example">
<description><![CDATA[var currentURL = document.URL; alert(currentURL);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.vlinkColor">
<description>Returns the color of links that the user has visited in the document.
Syntax: color = document.vlinkColor document.vlinkColor = color
Parameters: color is a string representing the color as a word (e.g., "red') or as an octal value, as in HTML (e.g., "#eee")
The default for this property is purple.
DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="document.width">
<description>Returns the width of the current document in pixels.
Syntax: pixels = document.width;
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[function init() {
alert("The width of the document is " + document.width + " pixels.");
}
]]></description>
</property>
</properties>
</element>
</group>
<group name="Methods">
<element kind="var" name="document.clear()">
<description>The clear method clears the current document of all its content.
Syntax: document.clear()
DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
<button label="empty" onclick="document.clear();" />
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.close()">
<description>The document.close() method finishes writing to a document, opened with document.open().
Syntax: document.close();
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-98948567</description>
<properties>
<property kind="example">
<description><![CDATA[
// open a document to write to it.
// finish by closing the document.
document.open();
document.write("<P>The only content</P>.");
document.close();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createAttribute()">
<description>createAttribute creates a new attribute node, and returns it.
Syntax: attribute = document.createAttribute(name)
Parameters: attribute is an attribute node. name is a string containing the name of the attribute.
The return is a node of type attribute. Once you have this node you can, as in the foregoing example, set its value with the value property. The DOM does not enforce what sort of attributes can be added to a particular element in this manner.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1084891198</description>
<properties>
<property kind="example">
<description><![CDATA[var node = document.getElementById("div1");
var attr = document.createAttribute("proportion");
attr.value = "100";
node.setAttributeNode(attr);
alert(node.proportion); // "100"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createDocumentFragment()">
<description>document.createDocumentFragment creates an empty document fragment
Syntax: documentFragment = document.createDocumentFragment()
Parameters: documentFragment is an object.
A documentFragment is a "lightweight" or "minimal" document object. It is very common to want to be able
to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing
a user command like cut or rearranging a document by moving fragments around. It is desirable to have an
object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true
that a document object could fulfill this role, a document object can potentially be a heavyweight object,
depending on the underlying implementation. What is really needed for this is a very lightweight object.
documentFragment is such an object.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-35CB04B5</description>
<properties>
<property kind="example">
<description><![CDATA[
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode('<div>Moveable Div</div>'));
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createElement()">
<description>Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
Syntax: element = element.createElement(type)
Parameters: element is an object. type is a string that represents the type of element to be created.
In addition, if there are known attributes with default values, attribute nodes representing them are automatically created and attached to the element.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-2141741547</description>
<properties>
<property kind="example">
<description><![CDATA[
div = document.createElement("div");
preface = document.getElementById("preface");
document.insertBefore(div, preface);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createEvent()">
<description>Creates an event of the type specified. Note that the instance returned implements the Event interface and can be passed to element.dispatchEvent
Syntax: event = document.createEvent(type)
Parameters: event is an object. type is a string that represents the type of event to be created. Common ones include KeyEvent and MouseEvent.
Specification: http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-DocumentEvent</description>
<properties>
<property kind="example">
<description><![CDATA[
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
b = document.getElementById("button1");
res = b.dispatchEvent(evt);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createRange()">
<description>Returns a new Range object.
Syntax: range = document.createRange();
Once a Range is created, you need to set its boundary points before you can make use of most of its methods.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-DocumentRange-method-createRange</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.createTextNode()">
<description>Creates a new Text node.
Syntax: text = document.createTextNode(data)
Parameters: text is a Text node. data is a string containing the data to be put in the text node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1975348127</description>
<properties>
<property kind="example">
<description><![CDATA[
t = document.createTextNode("Plain Old Text.");
p = document.getElementById("firstP");
p.appendChild(t);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.evaluate()">
<description>Returns an XPathResult based on an XPath expression and other given parameters.
Syntax: var xpathResult = document.evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result);
Parameters: xpathExpression is a string representing the XPath to be evaluated.
contextNode is the node inside which the search will take place. document is most common.
namespaceResolver is a function that will be passed any namespace prefixes and should return a string
representing the namespace URI associated with that prefix. null is common for HTML documents or when
no namespace prefixes are used. resultType is an integer that corresponds to the type of result XPathResult
to return. Use named constant properties, such as XPathResult.ANY_TYPE, of the XPathResult constructor,
which correspond to integers from 0 to 9. result is an existing XPathResult to use for the results. null is most
common and will create a new XPathResult
XPath expressions can be evaluated on HTML and XML documents.
Result Type Value Description
ANY_TYPE 0 Whatever type naturally results from the given expression.
NUMBER_TYPE 1 A result set containing a single number. Useful, for example, in an XPath expression using the count() function.
STRING_TYPE 2 A result set containing a single string.
BOOLEAN_TYPE 3 A result set containing a single boolean value. Useful, for example, an an XPath expression using the not() function.
UNORDERED_NODE_ITERATOR_TYPE 4 A result set containing all the nodes matching the expression. The nodes in the result set are not necessarily in the same order they appear in the document.
ORDERED_NODE_ITERATOR_TYPE 5 A result set containing all the nodes matching the expression. The nodes in the result set are in the same order they appear in the document.
UNORDERED_NODE_SNAPSHOT_TYPE 6 A result set containing snapshots of all the nodes matching the expression. The nodes in the result set are not necessarily in the same order they appear in the document.
ORDERED_NODE_SNAPSHOT_TYPE 7 A result set containing snapshots of all the nodes matching the expression. The nodes in the result set are in the same order they appear in the document.
ANY_UNORDERED_NODE_TYPE 8 A result set containing any single node that matches the expression. The node is not necessarily the first node in the document that matches the expression.
FIRST_ORDERED_NODE_TYPE 9 A result set containing the first node in the document that matches the expression.
Results of NODE_ITERATOR types contain references to nodes in the document. Modifying a node will invalidate the iterator. After modifying a node, attempting to iterate through the results will result in an error.
Results of NODE_SNAPSHOT types contain snapshots, or copies of nodes in the document. These nodes can be modified, but modifying them does not modify the document.
Specification: http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-evaluate</description>
<properties>
<property kind="example">
<description><![CDATA[var headings = document.evaluate("//h2", document, null, XPathResult.ANY_TYPE,null);
/* Search the document for all h2 elements.
* The result will likely be an unordered node iterator. */
var thisHeading = headings.iterateNext();
var alertText = "Level 2 headings in this document are:\n"
while (thisHeading) {
alertText += thisHeading.textContent + "\n"
thisHeading = headings.iterateNext();
}
alert(alertText); // Alerts the text of all h2 elements
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.getElementById()">
<description>Returns the element whose ID is specified.
Syntax: element = document.getElementById(id);
getElementById is an absolute mainstay of the DOM. One of the most important notions in DOM
programming is that elements be identified uniquely so that they can be grabbed and manipulated.
If there is no element with the given id, this function returns null. Note also that the DOM implementation
must have information that says which attributes are of type ID. Attributes with the name "id" are not of type
ID unless so defined (in DTD). The id attribute is defined to be of ID type in the common cases of XHTML, XUL, and other.
Implementations that do not know whether attributes are of type ID or not are expected to return null.
getElementById was introduced in DOM Level 2.
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-getElBId</description>
<properties>
<property kind="example">
<description><![CDATA[// for <p id="p1" class="reggy" align="right">text</p>
firstParagraph = document.getElementById("p1");
attribList = first_p.attributes;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.getElementsByName()">
<description>Returns a list of elements with a given name in the (X)HTML document.
Syntax: elements = document.getElementsByName(name)
Parameters: elements is a NodeList of elements. name is a string representing the value of the name attribute on the element.
document.getElementsByName returns a NodeList of all the elements with a given value for the name attribute.
Unlike getElementsByTagName, which takes the name of the element itself,
this method only works for elements for which name attributes have been explicitly given.
This method is only applicable to (X)HTML documents.
Specification: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-71555259</description>
<properties>
<property kind="example">
<description><![CDATA[
// return some of the divs
//<div name="up">200</div>
//<div name="up">145</div>
//<div name="down">146</div>
//<div name="other">178</div>
up_divs = document.getElementsByName("up");
dump(up_divs.item(0).tagName); // returns "div"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.getElementsByTagName()">
<description>Returns a list of elements with the given tag name in the document.
Syntax: elements = document.getElementsByTagName(name)
where name is either the local name of elements to look for or the special value "*", which matches all tags.
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-A6C9094</description>
</element>
<element kind="var" name="document.importNode()">
<description>createAttribute creates a new attribute node, and returns it.
Syntax: node = document.importNode(externalNode, deep)
Parameters: node is the new node that is imported into the document. The new node's parentNode is null
and is not yet inserted into the document tree. externalNode is the node from another document that is
being imported. deep is true or false. If true, the node will be imported with all its children.
If false, the node will be imported without any children.
The node is not removed from the original document. The imported node is a clone of the original.
Nodes from external documents must be imported before they can inserted into the current document.
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document</description>
<properties>
<property kind="example">
<description><![CDATA[var iframe = document.getElementsByTagName("iframe")[0];
var oldNode = iframe.contentDocument.getElementById("myNode");
var newNode = document.importNode(oldNode,true);
document.getElementById("container").appendChild(newNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.loadOverlay()">
<description>Loads a XUL overlay and merges it with the current document, notifying an observer when the merge is complete.
Usage: document.loadOverlay(url, observer);
url: A string containing the absolute URL of the overlay to load.
observer: object implementing nsIObserver that will be notified with a message of topic "xul-overlay-
merged" when the merge is complete, or null if no observer is needed. The subject parameter of observe
will implement nsIURI and will contain the URI of the merged overlay.
This API is not frozen and will change in 2.0 timeframe.
XUL-specific method. Not part of any specification. Defined in nsIDOMXULDocument.idl. </description>
</element>
<element kind="var" name="document.open()">
<description>The document.open() method opens a document for writing.
Syntax: document.open();
If a document exists in the target, this method clears it (see the example above).
Also, an automatic document.open() call happens when document.write() is called after the page has
loaded, but that's not defined in the W3C specification.
Do not confuse this method with window.open(). document.open allows you overwrite current document
or append to it, while window.open provides a way to open a new window, leaving the current document
intact. Since window is the global object, just calling open(...) does the same as window.open(...).
You can close the opened document using document.close().
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-72161170</description>
<properties>
<property kind="example">
<description><![CDATA[
// In this example, the document contents are
// overwritten as the document
// is reinitialized on open().
document.write("<html><p>remove me</p></html>");
document.open();
// document is empty.
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.write()">
<description>Writes a string of text to a document stream opened by document.open().
Syntax: document.write(markup);
Writing to a document that has already loaded without calling document.open() will automatically perform a document.open call. Once you have finished writing, it is recommended to call document.close(), to tell the browser to finish loading the page. The text you write is parsed into the document's structure model. In the example above, the h1 element becomes a node in the document.
If the document.write() call is embedded directly in the HTML code, then it will not call document.open().
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-75233634</description>
<properties>
<property kind="example">
<description><![CDATA[
document.open();
document.write("<h1>hello!</h1>");
document.close();
<div>
<script type="text/javascript">
document.write("<h1>Main title</h1>")
</script>
</div>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="document.writeln()">
<description>Writes a string of text followed by a newline character to a document.
Syntax: document.writeln(line)
Parameters: line is string containing a line of text.
document.writeln is the same as document.write but adds a newline.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-35318390</description>
<properties>
<property kind="example">
<description><![CDATA[
document.writeln("<p>enter password:</p>");
]]></description>
</property>
</properties>
</element>
</group>
</group>
<group name="element">
<note title="Introduction">This chapter provides a brief reference for all of the methods, properties, and events available to all HTML and XML elements in the Netscape 6 DOM.
These DOM interfaces cross the various specification levels, but tend to concentrate on the published DOM Level 2 HTML recommendation. Each member includes a link to the appropriate place in the W3C DOM specifications.
Here, "Elements" refers to the interface that all HTML and XML elements have available to them from the DOM. There are more specialized interfaces for particular objects-the BODY element, for example, has extra functions and properties you can use, as do tables. This chapter refers to the interface that all elements share. </note>
<group name="Properties">
<element kind="var" name="attributes">
</element>
<element kind="var" name="childNodes">
<description>Returns an array of child nodes on the given element node.
Syntax: var ndList = elementNodeReference.childNodes;
The document object itself has 2 children: the Doctype declaration and the HTML element. The items in the array are objects and not strings. To get data from those node objects, you must use their attributes (e.g. elementNodeReference.childNodes[1].nodeName to get the name, etc.).
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1451460987</description>
<properties>
<property kind="example">
<description><![CDATA[
// parg is an object reference to a <p> element
if (parg.hasChildNodes())
{
var children = parg.childNodes;
for (var i = 0; i < children.length; i++)
{
// do something with each child as children[i]
// NOTE: List is live, Adding or removing children will change the list
}
}
// This is one way to remove all children from a node
// box is an object refrence to an element with children
while( box.firstChild ) {
//The list is LIVE so it will re-index each call
box.removeChild( box.firstChild );
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="className">
<description>This attribute gets/sets the class attribute of the specified element.
Syntax: var cName = elementNodeReference.className; elementNodeReference.className = cName;
The name className is used for this property instead of class because of conflicts with the "class" keyword in many languages which are used to manipulate the DOM.
Specification: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-95362176</description>
<properties>
<property kind="example">
<description><![CDATA[
var elementNodeReference = document.getElementById("div1");
if (elementNodeReference.className == "fixed")
{
// skip a particular class of element
goNextElement();
};
]]></description>
</property>
</properties>
</element>
<element kind="var" name="clientHeight">
<description>DHTML property that represents the inner height of an element.
This includes possible padding but not horizontal scrollbar (if present, if rendered), not border nor margin.
If the element has an horizontal scrollbar, then its height value is substracted from the css height property
value and from the vertical css padding value of the element in the computation of the clientHeight value.
clientHeight is a property of the DHTML object model which was first introduced by MSIE. It represents the inner height of an element.
Syntax: var intElemClientHeight = document.getElementById(id_attribute_value).clientHeight;
Specification: clientHeight is part of the MSIE's DHTML object model. clientHeight is not part of any W3C specification or technical recommendation.
References:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientheight.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/clientHeight.html</description>
</element>
<element kind="var" name="clientLeft">
<description> clientLeft is a property of the DHTML object model which was first introduced by MSIE.
It represents the width of the left border (and the width of the vertical scrollbar if rendered on the left side) of an element.
Syntax: var intElemClientLeft = document.getElementById(id_attribute_value).clientLeft;
Specification: clientLeft is part of the MSIE's DHTML object model. clientLeft is not part of any W3C specification or technical recommendation.
References:
Currently, Mozilla 1.x, Seamonkey 1.x and Firefox 1.x do not support clientLeft.
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientleft.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
</description>
</element>
<element kind="var" name="clientTop">
<description>clientTop is a property of the DHTML object model which was first introduced by MSIE.
It represents the height of the top border of an element.
Syntax: var intElemClientTop = document.getElementById(id_attribute_value).clientTop;
Specification: clientTop is part of the MSIE's DHTML object model. clientTop is not part of any W3C specification or technical recommendation.
References:
Currently, Mozilla 1.x, Seamonkey 1.x and Firefox 1.x do not support clientTop.
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clienttop.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp</description>
</element>
<element kind="var" name="clientWidth">
<description> clientWidth is a property of the DHTML object model which was first introduced by MSIE.
It represents the inner width of an element. Syntax: var intElemClientWidth = document.getElementById(id_attribute_value).clientWidth;
Specification: clientWidth is part of the MSIE's DHTML object model. clientWidth is not part of any W3C specification or technical recommendation.
References:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clientwidth.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/clientWidth.html
</description>
</element>
<element kind="var" name="dir">
<description>The dir attribute gets or sets the text writing directionality of the content of the current element.
Syntax: var CurrentWritingDirection = elementNodeReference.dir; elementNodeReference.dir = NewWritingDirection;
The text writing directionality of an element is which direction that text goes (for support of different language systems). Arabic languages and Hebrew are typical languages using the rtl directionality.
Specification: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-52460740</description>
<properties>
<property kind="example">
<description><![CDATA[
var parg = document.getElementById("para1");
parg.dir = "rtl";
// change the text direction on a paragraph identified as "para1"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="firstChild">
<description>firstChild returns the first child element of the current element
Syntax: element = element.firstChild
Parameters: The element parameter returned is a node of type element.
Returns NULL if the current node is childless.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-169727388</description>
<properties>
<property kind="example">
<description><![CDATA[
trow = document.getElementById("row1");
left_cell = trow.firstChild;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="id">
<description>The id property uniquely identifies the current element.
Syntax: id_str = element.id element.id = id_str
Parameters: id_str is a string representing the id of the current element.
There is no more central property to the domain of web development than id. The ID of an element is what
is most often used to retrieve it (e.g., with getElementById), and it allows the various nodes in a document
to be manipulated independently of one another.
In HTML and in XUL, the id is defined as an attribute on the element like so:
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-63534901</description>
<properties>
<property kind="example">
<description><![CDATA[
if (element.id != "main_loop")
goBack();
<td id="table-cell2" />
]]></description>
</property>
</properties>
</element>
<element kind="var" name="innerHTML">
<description>innerHTML sets or gets all of the markup and content within a given element.
Syntax: var markup = element.innerHTML; element.innerHTML = markup;
Though not actually a part of the W3C DOM specification, this property provides a simple way to completely replace the contents of an element. For example, the entire contents of the document body can be deleted by:
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[// HTML:
// <div id="d"><p>Content</p>
// <p>Further Elaborated</p>
// </div>
d = document.getElementById("d");
dump(d.innerHTML);
// the string "<p>Content</p><p>Further Elaborated</p>"
// is dumped to the console window
document.body.innerHTML = ""; // Replaces body content with an empty string.
// Copy and paste into address bar as a single line
javascript:x=document.body.innerHTML.replace(/</g,'&lt;').replace(/\n/g,'<br>'); document.body.innerHTML = x;]]></description>
</property>
</properties>
</element>
<element kind="var" name="lang">
<description>This property gets or sets the base language of an element's attribute values and text content.
Syntax: var languageUsed = elementNodeReference.lang; elementNodeReference.lang = NewLanguage;
The language code returned by this property is defined in RFC 1766.
Common examples include "en" for English, "ja" for Japanese, "es" for Spanish and so on.
The default value of this attribute is unknown. Note that this attribute, though valid at the individual element level described here, is most often specified for the root element of the document.
Specification: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-59132807</description>
<properties>
<property kind="example">
<description><![CDATA[
// this snippet compares the base language and
// redirects to another url based on language
if (document.documentElement.lang == "en")
{
window.location.href = "Some_document.html.en";
}
else if(document.documentElement.lang == "ru")
{
window.location.href = "Some_document.html.ru";
};
]]></description>
</property>
</properties>
</element>
<element kind="var" name="lastChild">
<description>lastChild returns the last child of the current element.
Syntax: last_child = element.lastChild
Parameters: last_child is the final element node in the nodeList of children on the current element.
Returns NULL if there are no child elements.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-61AD09FB</description>
<properties>
<property kind="example">
<description><![CDATA[
tr = document.getElementById("row1");
corner_td = tr.lastChild;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="length">
<description>length returns the number of items in a list.
Syntax: no_of_items = nodeList.length
no_of_items is an integer value representing the number of items in a list.
length is a very common property in DOM programming. It's very common to test the length of a list (to see if it exists at all) and to use it as the iterator in a for loop, as in the example above.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-203510337</description>
<properties>
<property kind="example">
<description><![CDATA[
// all the paragraphs in the document
items = document.getElementsByTagName("p");
// are there any at all?
if ( items.length ) {
// for each item in the list,
// append the entire element as a string of HTML
for (var i = 0; i < items.length; i++) {
gross += items[0].innerHTML;
// gross is now all the HTML for the paragraphs
} }
]]></description>
</property>
</properties>
</element>
<element kind="var" name="localName">
<description>localName returns the local part of the qualified name of this node.
Syntax: name = element.localName
Parameters: name is the local name as a string.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement on the document object, this is always NULL.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-NodeNSLocalN</description>
<properties>
<property kind="example">
<description><![CDATA[
// qualifiedName = "XXXYYY"
d = document.getElementById("div1");
text_field = document.getElementById("t");
text_field.setAttribute("value", d.localName);
// text_field reads "YYY"
<ecomm:business id="soda_shop" type="brick_n_mortar">
<ecomm:partners>
<ecomm:partner id="1001">Tony's Syrup Warehouse
</ecomm:partner>
</ecomm:partner>
</ecomm:business>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="namespaceURI">
<description>The namespace URI of this node, or NULL if it is unspecified.
Syntax: namespace = element.namespaceURI
Parameters: namespace is a string that represents the namespace URI of the current node.
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always NULL.
Per the Namespaces in XML Specification, an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#Namespaces-Considerations nameSpaceURI</description>
<properties>
<property kind="example">
<description><![CDATA[
if (node.localName == "browser" && node.namespaceURI == kXULNSURI) {
// xul browser
this.viewee = node.webNavigation.document;
//...
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="nextSibling">
<description>Returns the node immediately following the current one in the tree.
Syntax: next_element = element.nextSibling
Parameters: next_element is the element node directly after the current element in the list of siblings (i.e., the list of children for the parentNode).
Returns NULL if there are no more nodes.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-6AC54C2F</description>
<properties>
<property kind="example">
<description><![CDATA[
// in a table, the cells are siblings
cell1 = document.getElementById("td1");
cell2 = cell1.nextSibling;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="nodeName">
<description>Returns the name of the current node as a string.
Syntax: var nName = elementNodeReference.nodeName;
Here are the returned values for different types of node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-F68D095</description>
<properties>
<property kind="example">
<description><![CDATA[
<div id="d1">hello world</div>
<input type="text" id="t"/>
var div1 = document.getElementById("d1");
var text_field = document.getElementById("t");
text_field.value = div1.nodeName;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="nodeType">
<description>Returns a code representing the type of the underlying node.
Syntax: type = node.nodeType
Parameters: type is an unsigned short with one of the following values:
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-111237558</description>
<properties>
<property kind="example">
<description><![CDATA[var node = document.documentElement.firstChild;
if(node.nodeType != Node.COMMENT_NODE)
alert("You should comment your code well!");
]]></description>
</property>
</properties>
</element>
<element kind="var" name="nodeValue">
<description>Returns the value of the current node.
Syntax: value = document.nodeValue
For the document itself, nodeValue returns null. For text, comment, and CDATA nodes, nodeValue returns the content of the node. For attribute nodes, the value of the attribute is returned.
The following table shows the return values for different elements:
Attr value of attribute
CDATASection content of the CDATA Section
Comment content of the comment
Document null
DocumentFragment null
DocumentType null
Element null
NamedNodeMap null
EntityReference null
Notation null
ProcessingInstruction entire content excluding the target
Text content of the text node
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-F68D080</description>
</element>
<element kind="var" name="offsetHeight">
<description>offsetHeight is a property of the DHTML object model which was first introduced by MSIE. It is sometimes referred as an element physical/graphical dimensions or an element's box height.
Syntax: var intElemOffsetHeight = document.getElementById(id_attribute_value).offsetHeight;
Specification: offsetHeight is part of the MSIE's DHTML object model. offsetHeight is not part of any W3C specification or technical recommendation.
References: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/offsetheight.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/dom_el_ref18.html</description>
</element>
<element kind="var" name="offsetLeft">
<description>Gets/sets the number of pixels that the current element is offset to the left within the offsetParent node.
Syntax: left = element.offsetLeft
Parameters: left is an integer representing the offset to the left in pixels.
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
color_table = document.getElementById("t1");
tOLeft = color_table.offsetLeft;
if ( tOLeft > 5 ) {
// large left offset: do something here
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="offsetParent">
<description>offsetParent returns a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. If the element is non-positioned, the root element (html in standards compliant mode; body in quirks rendering mode) is the offsetParent.
Syntax: parentObj = element.offsetParent
Parameters: parentObj is an object reference to the element in which the current element is offset.
Specification: DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="offsetTop">
<description>offsetTop returns the position of the current element relative to the top of the offsetParent node.
Syntax: topPos = element.offsetTop
Parameters: topPos is the number of pixels from the top of the parent element.
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
d = document.getElementById("div1");
topPos = d.offsetTop;
if (topPos > 10 ) {
// object it offset less
// than 10 pixels in its parent
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="offsetWidth">
<description> offsetWidth is a property of the DHTML object model which was first introduced by MSIE.
It is sometimes referred as an element physical/graphical dimensions or an element's box width.
Syntax: var intElemOffsetWidth = document.getElementById(id_attribute_value).offsetWidth;
Specification: offsetWidth is part of the MSIE's DHTML object model.
offsetWidth is not part of any W3C specification or technical recommendation.
References: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/offsetwidth.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/dom_el_ref22.html</description>
</element>
<element kind="var" name="ownerDocument">
<description>The ownerDocumenturns the top-level document object for this node.
Syntax: document = element.ownerDocument
Parameters: he document object parent of the current element.
The document object returned by this property is the main object with which all the child nodes in the actual HTML document are created. If this property is used on a node that is itself a document, the result is NULL.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#node-ownerDoc</description>
<properties>
<property kind="example">
<description><![CDATA[
// given a node "p", get the top-level HTML child
// of the document object
d = p.ownerDocument;
html = d.documentElemeniption>
</property>
</properties>
</element>
<element kind="var" name="parentNode">
<description>The parentNode property returns the parent of the current element.
Syntax: pElement = element.parentNode
Parameters: pElement is the element parent of the current node.
parentNode returns null for the following node types : Attr, Document, DocumentFragment, Entity and Notation. It also returns null if the node has just been created and is not yet attached to the tree.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1060184317</description>
<properties>
<property kind="example">
<description><![CDATA[
text_field = document.getElementById("t");
if ( div1.parentNode == document ){
text_field.setAttribute("value", "top-level");
// textfield displays text "top-level"
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="prefix">
<description>prefix returns the namespace prefix of the specified node, or null if no prefix is specified.
Syntax: string = element.prefix element.prefix = string
This will only work when a namespace-aware parser is used, i.e. when a document is served with an XML mime-type. This will not work for HTML documents.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-NodeNSPrefix</description>
<properties>
<property kind="example">
<description><![CDATA[<x:div onclick="alert(this.prefix)"/>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="previousSibling">
<description>Returns the node immediately previous to the current one in the tree.
Syntax: pNode = elementNode.previousSibling
Parameters: pNode is the node prior to this one in the ordered list.
Returns NULL if there are no more nodes.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-640FB3C8</description>
<properties>
<property kind="example">
<description><![CDATA[
n1 = n2.previousSibling;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="scrollHeight">
<description> scrollHeight is a property of the DHTML object model which was first introduced by MSIE.
It is referred as the height of an element physical scrolling view.
Syntax: var intElemScrollHeight = document.getElementById(id_attribute_value).scrollHeight;
Specification: scrollHeight is part of the MSIE's DHTML object model.
scrollHeight is not part of any W3C specification or technical recommendation.
References: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/scrollheight.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/scrollHeight.html</description>
</element>
<element kind="var" name="scrollLeft">
<description>scrollTop is a property of the DHTML object model which was first introduced by MSIE.
It is referred as the distance to the top of an element physical scrolling view.
Syntax: var intElemScrollTop = document.getElementById(id_attribute_value).scrollTop;
Specification: scrollTop is part of the MSIE's DHTML object model.
scrollTop is not part of any W3C specification or technical recommendation.
References: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/scrolltop.asp?frame=true
http://msdn.microsoft.com/workshop/author/om/measuring.asp
http://www.mozilla.org/docs/dom/domref/scrollTop.html
</description>
</element>
<element kind="var" name="scrollTop">
</element>
<element kind="var" name="scrollWidth">
</element>
<element kind="var" name="style">
<description>style returns the block of style rules on the current element.
Syntax: styleBlock = element.style ( element.style.styleAttr = value )
Parameters: styleBlock is a string containing the style rules on the current element.
style is a very commonly used property in DOM programming.
You can use it to get the style rules associated with a particular element, and though you cannot set style on
an element by assigning to the style property directly, you can use the style property to get to the writable
style attributes on the node, as in the short example above. See the Gecko DOM
Specification:http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSStyleRule-style
</description>
<properties>
<property kind="example">
<description><![CDATA[div = document.getElementById("div1");
div.style.marginTop = ".25in";]]></description>
</property>
</properties>
</element>
<element kind="var" name="tabIndex">
<description>Gets/sets the tab order of the current element.
Syntax: element.tabIndex = iIndex
Parameters: iIndex is a number
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-40676705</description>
<properties>
<property kind="example">
<description><![CDATA[
b1 = document.getElementById("button1");
b1.tabIndex = 1;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="tagName">
<description>tagName returns the name of the element.
Syntax: elementName = element.tagName
Parameters: elementName is a string containing the name of the current element.
In XML (and XML-based languages such as XHTML), tagName preserves case.
In HTML, tagName returns the element name in the canonical uppercase form.
The value of tagName is the same as that of nodeName.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-104682815</description>
<properties>
<property kind="example">
<description><![CDATA[
<span id="born">When I was born...</span>
var span = document.getElementById("span");
alert(span.tagName);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="textContent">
<description>Returns the text contents of this node and its descendants, if any.
Syntax: text = element.textContent element.textContent = "this is some sample text"
textContent returns null if the element is a document, a document type, or a notation.
If the node is a CDATA section, a comment, a processing instruction, or a text node, textContent returns the text inside this node (the nodeValue).
For other node types, textContent returns the concatenation of the textContent attribute value of every child node, excluding comments and processing instruction nodes.
This is an empty string if the node has no children. Setting this property on a node removes all of its children and replaces them with a single text node with the given value.
Specification: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent</description>
<properties>
<property kind="example">
<description><![CDATA[
Consider the following HTML fragment :
<div id="myDiv">This is <span>some</span> text</div>
var text = document.getElementById("myDiv").textContent;
will set text to "This is some text".
document.getElementById("myDiv").textContent = "This is some text";
will result in the following fragment :
<div id="myDiv">This is some text</div>
]]></description>
</property>
</properties>
</element>
</group>
<group name="Methods">
<element kind="var" name="addEventListener()">
<description>addEventListener allows the registration of event listeners on the event target.
Syntax: element.addEventListener(type, listener, useCapture);
Parameters: type A string representing the event type being registered. listener
The listener parameter takes an interface implemented by the user which contains the methods to be called
when the event occurs. useCapture If true, useCapture indicates that the user wishes to initiate capture.
After initiating capture, all events of the specified type will be dispatched to the registered EventListener
before being dispatched to any EventTargets beneath them in the tree. Events which are bubbling upward
through the tree will not trigger an EventListener designated to use capture.
If an EventListener is added to an EventTarget while it is processing an event, it will not be triggered by the
current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical EventListeners are registered on the same EventTarget with the same parameters the
duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are
discarded they do not need to be removed with the removeEventListener method.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget-addEventListener</description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<title>DOM Event Examples</title>
<style>
#t { border: 1px solid red }
#t1 { background-color: pink; }
</style>
<script>
// Event Registration Example
function l_func() {
t2 = document.getElementById("t2");
t2.innerHTML = "three";
}
function load() {
el = document.getElementById("t");
el.addEventListener("click", l_func, false);
}
</script>
</head>
<body onload="load();">
<table id="t">
<tr><td id="t1">one</td></tr>
<tr><td id="t2">two</td></tr>
</table>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="appendChild()">
<description>The appendChild method inserts the specified node into the list of nodes on the current document, returning the created node.
Syntax: element.appendChild(newChild)
Parameters: newChild is a node.
appendChild is one of the fundamental methods of web programming using the DOM. The appendChild
method inserts a new node into the DOM structure of the HTML document, and is the second part of the
one-two, create-and-append process so central to building web pages programmatically.
The example above illustrates this basic process.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-184E7107</description>
<properties>
<property kind="example">
<description><![CDATA[
// puts the new, empty paragraph at the end
// of the document
p = document.createElement("p");
element.appendChild(p);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="blur()">
<description>The blur method removes keyboard focus from the current element.
Syntax: element.blur()
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-28216144</description>
</element>
<element kind="var" name="click()">
<description>The click method excecutes a click on the current element.
Syntax: element.click()
The click method simulates a click event on the current element. This is frequently used to execute event handlers that have been placed on the current element or on elements above it in the "event chain."
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-2651361</description>
</element>
<element kind="var" name="cloneNode()">
<description>The cloneNode method returns a duplicate of the current node.
Syntax: dupNode = element.cloneNode(deep)
Parameters: deep is a boolean value indicating whether the clone is a deep clone or not (see notes below).
The duplicate node returned by cloneNode() has no parent. Cloning a node copies all of its attributes and their values but does not copy any of the text that the node contains, since that text is contained in a child Text node.
A deep clone is a clone in which the given node and the whole subtree beneath it (including the text that makes up any child Text nodes) is copied and returned.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-3A0ED0A4</description>
<properties>
<property kind="example">
<description><![CDATA[
p = document.getElementById("para1");
p_prime = p.cloneNode(true);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="dispatchEvent()">
<description>The dispatchEvent method allows the dispatch of events into the implementation's event model.
Syntax: boolean = element.dispatchEvent(event)
Parameters: event is an event object that contains information about the type, behavior, and contextual information of the event to be dispatched.
When you create and dispatch an event using this method, the event has the same effect as events dispatched by user interaction.
They are "real" events, in other words, and they bubble up the UI in the same way. See the event object interface for more information about the information that is passed in with this method.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget-dispatchEvent</description>
<properties>
<property kind="example">
<description><![CDATA[
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
b = document.getElementById("button1");
res = b.dispatchEvent(evt);
if ( res ) {
// None of the handlers called preventDefault
b.disabled = true;
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="focus()">
<description>focus sets focus on the current element.
Syntax: element.focus()
Calling the focus method on an element is equivalent to selecting that element in the user interface.
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-32130014</description>
</element>
<element kind="var" name="getAttribute()">
<description>getAttribute returns the value of the named attribute on the specified element.
Syntax: attribute = element.getAttribute(attributeName)
Parameters: attributeName is the name of the attribute whose value you want to get.
getAttribute is another very common and useful method for web developers. The complement to this method is setAttribute, which allows you to change the value of a named attribute.
There is also getAttributeNS, which is a namespace-aware variant of getAttribute.
Specification: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-666EE0F9</description>
<properties>
<property kind="example">
<description><![CDATA[var div1 = document.getElementById("div1");
var align = div1.getAttribute("align");
alert(align); // shows the value of align for the element with id="div1"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="getAttributeNode()">
<description>Returns the attribute of the current element as a separate node.
Syntax: attributeNode = element.getAttributeNode(nodeName)
Parameters: nodeName is a string containing the name of the node. attributeNode is a separate Attribute node.
The Attribute node inherits from node, but is not considered a part of the document tree. Common node attributes like parentNode, previousSibling, and nextSibling are NULL for an Attribute node. You can, however, get the element to which the attribute belongs with the ownerElement property.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-217A91B8</description>
<properties>
<property kind="example">
<description><![CDATA[
// html: <div id="top" />
t = document.getElementById("top");
iNode = t.getAttributeNode("id");
// iNode.value = "top"
]]></description>
</property>
</properties>
</element>
<element kind="var" name="getAttributeNodeNS()">
<description>Returns Node for the attribute with the given namespace and name as a separate node.
Syntax: attributeNode = element.getAttributeNodeNS(namespace, nodeName)
Parameters: namespace is a string specifying the namespace of the attribute. nodeName is a string specifying
the name of the attribute. attributeNode is the node for specified attribute.
The attribute node implements the Node interface, but is not considered a part of the document tree.
Common node attributes like parentNode, previousSibling, and nextSibling are NULL for an attribute node.
You can, however, get the element to which the attribute belongs with the ownerElement
property.getAttributeNodeNS is more specific than getAttributeNode in that it allows you to specify
attributes that are part of a particular namespace. The corresponding setter method is setAttributeNodeNS.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-217A91B8</description>
</element>
<element kind="var" name="getAttributeNS()">
</element>
<element kind="var" name="getElementsByTagName()">
<description>Returns a list of the descendant elements of a given name on the current element.
Syntax: elements = element.getElementsByTagName(tagName)
Parameters: elements is a nodeList of elements. tagName is a string representing the name of the elements. The special string "*" represents all elements.
getElementsByTagName on the element is the same as getElementsByTagName on the document, except that its search is restricted to those elements which are descendants of the current element.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-A6C9094</description>
<properties>
<property kind="example">
<description><![CDATA[
// check the alignment on a number of cells in a table.
table = document.getElementById("forecast-table");
cells = table.getElementsByTagName("td");
for (var i = 0; i < cells.length; i++) {
status = cells[i].getAttribute("status");
if ( status == "open") {
// grab the data
}
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="hasAttribute()">
<description>hasAttribute is a boolean value indicating whether the current element has the specified attribute or not.
Syntax: [ true | false ] = element.hasAttribute(attName)
Parameters: attName is a string representing the name of the attribute
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-ElHasAttrNS</description>
<properties>
<property kind="example">
<description><![CDATA[
// check that the attirbute exists
// before you set a value
d = document.getElementById("div1");
if d.hasAttribute("align") {
d.setAttribute("align", "center");
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="hasAttributeNS()">
<description>hasAttributeNS is a boolean value indicating whether the current element has an attribute with the specified name and namespace.
Syntax: [ true | false ] = element.hasAttribute(namespace, localName)
Parameters: namespace is a string representing the namespace you are looking for localName is a string representing the name of the attribute
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-ElHasAttrNS</description>
<properties>
<property kind="example">
<description><![CDATA[
// check that the attirbute exists
// before you set a value
d = document.getElementById("div1");
if d.hasAttributeNS(
"http://www.mozilla.org/ns/specialspace/",
"special-align") {
d.setAttribute("align", "center");
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="hasAttributes()">
<description>hasAttributes is a boolean value indicating whether the current element has any attributes.
Syntax: [ true | false ] = element.hasAttributes
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-NodeHasAttrs</description>
<properties>
<property kind="example">
<description><![CDATA[
t1 = document.getElementById("table-data");
if ( t1.hasAttributes ) {
// do something with
// t1.attributes
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="hasChildNodes()">
<description>hasChildNodes is a method that returns a boolean value indicating whether the current element has children or not.
Syntax: [ true | false ] = element.hasChildNodes()
Note that element.hasChildNodes, without the parentheses, is the incorrect usage of this method, and always returns a true value indicating that the method is available on the object. Do not be fooled.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-810594187</description>
<properties>
<property kind="example">
<description><![CDATA[
t1 = document.getElementById("table-data");
if ( t1.hasChildNodes() ) {
// table has kids }
]]></description>
</property>
</properties>
</element>
<element kind="var" name="insertBefore()">
<description>The insertBefore method allows you to insert a node before a reference element as a child of the current node.
Syntax: insertedElement = element.insertBefore(newElement, targetElement)
Parameters: insertedElement The node being inserted. newElement The node to insert. targetElement The node before which newElement is inserted.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-952280727</description>
<properties>
<property kind="example">
<description><![CDATA[
parentDiv = document.getElementById("parentDiv");
sp2 = document.getElementById("childSpan");
sp1 = document.createElement("span");
parentDiv.insertBefore(sp1, sp2);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="item()">
</element>
<element kind="var" name="normalize()">
<description>The normalize method puts the current node and all of its subtree into a "normalized" form (see below).
Syntax: element.normalize()
The normalized form of a subtree is that subtree's nodelist cleansed of extranous and adjacent Text nodes.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-normalize</description>
</element>
<element kind="var" name="removeAttribute()">
<description>The removeAttribute() method removes an attribute from the current element.
Syntax: element.removeAttribute(attName)
Parameters: attName is a string that names the attribute to be removed from the current node.
removeAttribute allows you to change the attribute list dynamically on the current node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-6D6AC0F9</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div align="left" width="200px" />
d = document.getElementById("div1");
d.removeAttribute("align");
// now: <div width="200px" />
]]></description>
</property>
</properties>
</element>
<element kind="var" name="removeAttributeNode()">
<description>removeAttributeNode removes the specified attribute from the current element.
Syntax: remove_attr = element.removeAttributeNode(attribute)
Parameters: attribute is the Attribute node that needs to be removed. remove_attr is an Attribute node.
If the removed Attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-D589198</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div id="top" align="center" />
d = document.getElementById("top");
d_align = d.getAttributeNode("align");
d.removeAttributeNode(d_align);
// align has a default value, center,
// so the removed attribute is immediately
// replaced: <div id="top" align="center" />
]]></description>
</property>
</properties>
</element>
<element kind="var" name="removeAttributeNS()">
<description>The removeAttributeNS method removes an attribute with the specified namespace and name.
Syntax: element.removeAttributeNS(namespace, attrName);
Parameters: namespace is a string that contains the namespace of the attribute. attName is a string that names the attribute to be removed from the current node.
removeAttributeNS allows you to change the attribute list dynamically on the current node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-6D6AC0F9</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
// special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// now: <div id="div1" width="200px" />
]]></description>
</property>
</properties>
</element>
<element kind="var" name="removeChild()">
<description>The removeChild method removes a child node from the current element.
Syntax: oldChild = element.removeChild(child)
Parameters: oldChild is the node that needs to be removed. child is a node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1734834066</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div id="top" align="center"><div id="nested"/></div>
d = document.getElementById("top");
d_nested = document.getElementById("nested");
throwaway_node = d.removeChild(d_nested);
// remove all children from element
element = document.getElementById("top");
while (element.firstChild) {
element.removeChild(element.firstChild);
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="removeEventListener()">
<description>removeEventListener allows the removal of event listeners from the event target.
Syntax: element.removeEventListener(type, listener, useCapture)
Parameters: type A string representing the event type being registered. listener The listener parameter
takes an interface implemented by the user which contains the methods to be called when the event occurs.
useCapture If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all
events of the specified type will be dispatched to the registered EventListener before being dispatched to any
EventTargets beneath them in the tree. Events which are bubbling upward through the tree will not trigger
an EventListener designated to use capture.
If an EventListener is removed from an EventTarget while it is processing an event, it will not be triggered by
the current actions. EventListeners can never be invoked after being removed. Calling removeEventListener
with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
See also addEventListener.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget-removeEventListener</description>
</element>
<element kind="var" name="replaceChild()">
<description>The replaceChild() method replaces one child node on the current element with another.
Syntax: element.replaceChild(newChild, oldChild)
Parameters: newChild is a node. oldChild is the existing child node to be replaced.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-785887307</description>
<properties>
<property kind="example">
<description><![CDATA[
<html>
<head>
<script language="javascript">
function init()
{
d1 = document.getElementById("top");
d2 = document.getElementById("in");
d_new = document.createElement("p");
d1.replaceChild(d_new, d2);
alert(d1.childNodes[1].nodeName)
}
</script>
</head>
<body onload="init()">
<div id="top" align="left">
<div id="in">in</div>
</div>
</body>
</html>
]]></description>
</property>
</properties>
</element>
<element kind="var" name="scrollIntoView()">
</element>
<element kind="var" name="setAttribute()">
<description>setAttribute adds a new attribute or changes the value of an existing attribute on the current element.
Syntax: element.setAttribute(name, value)
Parameters: name is the name of the new attribute as a string. value is the desired value of the new attribute.
If the attribute named already exists, then the value of that attribute is changed to the value passed in as part of this function. If it does not exist, then a new attribute node is created.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-F68F082</description>
<properties>
<property kind="example">
<description><![CDATA[
s d = document.getElementById("d1");
d.setAttribute("align", "center");
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setAttributeNode()">
<description>setAttributeNode adds a new attribute node to the current element.
Syntax: replaced_attr = element.setAttributeNode(attribute)
Parameters: attribute is a node of type Attribute replaced_attr is the replaced attribute node, if any, returned by this function
If the attribute named already exists on the element, then that attribute is replaced with the new one and the replaced one is returned. Note that this function does not the set the value of the new attribute, only creates it on the element. Use setAttribute to set or change the value on an existing node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-887236154</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div id="one" align="left">one</div>
// <div id="two">two</div>
d1 = document.getElementById("one");
d2 = document.getElementById("two");
a = d1.getAttributeNode("align");
d2.setAttributeNode(a);
alert(d2.attributes[1].value)
// returns: `left'
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setAttributeNodeNS()">
<description>setAttributeNodeNS adds a new attribute node with the specified namespace and name.
Syntax: replaced_attr=element.setAttributeNodeNS(namespace, attribute)
Parameters: namespace is the namespace of the attribute as a string. attribute is a node of type Attribute. replaced_attr is the replaced attribute node, if any, returned by this function.
If the attribute named already exists on the element, then that attribute is replaced with the new one and the replaced one is returned. The corresponding getter method for namespaced attribute nodes is getAttributeNodeNS. Note that this function does not the set the value of the new attribute, only creates it on the element. Use setAttributeNS to set or change the value on an existing node within a particular namespace.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-887236154</description>
<properties>
<property kind="example">
<description><![CDATA[
// <div id="one" special-align="utterleft">one</div>
// <div id="two">two</div>
myns = "http://www.mozilla.org/ns/specialspace";
d1 = document.getElementById("one");
d2 = document.getElementById("two");
a = d1.getAttributeNodeNS(
myns,
"special-align");
d2.setAttributeNodeNS(
myns,
a);
alert(d2.attributes[1].value)
// returns: `utterleft'
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setAttributeNS()">
<description>setAttributeNS adds a new attribute or changes the value of an attribute with the given namespace and name.
Syntax: element.setAttribute(namespace, name, value)
Parameters: namespace is the namespace of the new attribute as a string. name is the name of the new attribute as a string. value is the desired value of the new attribute.
If the attribute named already exists, then the value of that attribute is changed to the value passed in as part of this function. If it does not exist, then a new attribute node is created.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-F68F082</description>
<properties>
<property kind="example">
<description><![CDATA[
d = document.getElementById("d1");
d.setAttributeNS("http://www.mozilla.org/ns/specialspace", "align", "center");
]]></description>
</property>
</properties>
</element>
<element kind="var" name="supports()">
<description>The supports method tests if this DOM implementation supports a particular feature.
Syntax: boolean = element.supports(feature[, version])
Parameters: feature is a string that contains the name of the feature (e.g., "") version is a string containing the version number of the feature.
If version is not supplied, the method returns true is any version of the specified feature is supported.
Specification: Not part of the specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
if ( document.supports("package", "4.0") ) { // do something that only package 4.0 allows }
]]></description>
</property>
</properties>
</element>
</group>
<group name="Event Handlers">
<element kind="var" name="onblur">
<description>The onblur property returns the onBlur event handler code, if any, that exists on the current element.
Syntax: event handling code = element.onblur
The blur event is raised when an element loses focus.
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
warnFunc = window.onblur;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="onclick">
<description>The onclick property returns the onClick event handler code on the current element.
Syntax: event handling code = element.onclick
The click event is raised when the user clicks on an element.
Specification: Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
function pawnClick() {
p = document.getElementById("mutable");
p.onclick = "alert('moot!');";
text = p.onclick;
alert(text);
}
var el = document.getElementById('foo');
el.onclick = showPopup;
//NOTE: showPopup(); or showPopup(param); will NOT work here.
//Must be a reference to a function, not a function call.
function showPopup()
{
var popup = window.open(this.href, "popup", "height=800,width=600");
popup.focus();
return false;
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="ondblclick">
<description>The ondblclick property returns the onDblClick event handler code on the current element.
Syntax: event handling code = element.ondblclick
The dblclick event is raised when the user double clicks an element.
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// <img src="pawn.gif" onDblClick="movePawn(this);" />
function pawnClick() {
i = document.getElementById("img1");
alert(i.ondblclick);
}
// alerts: function anonymous(event) { movePawn(this) }
]]></description>
</property>
</properties>
</element>
<element kind="var" name="onfocus">
<description>The onfocus property returns the onFocus event handler code on the current element.
Syntax: event handling code = element.onfocus
The focus event is raised when the user sets focus on the given element.
Specification: Not part of specification. </description>
</element>
<element kind="var" name="onkeydown">
<description>The onkeydown property returns the onKeyDown event handler code on the current element.
Syntax: event handling code = element.onkeydown
The keydown event is raised when the user presses a keyboard key.
Specification: Not part of specification. </description>
</element>
<element kind="var" name="onkeypress">
<description>The onkeypress property returns the onKeyPress event handler code for the current element.
Syntax: event handling code = element.onkeypress
The keypress event is raised when the user presses a key on the keyboard.
Specification: Not part of specification. </description>
</element>
<element kind="var" name="onkeyup">
<description>The onkeyup property returns the onKeyUp event handler code for the current element.
Syntax: event handling code = element.onclick
The keyup event is raised when the user releases a key that's been pressed.
Specification: Not part of specification. </description>
</element>
<element kind="var" name="onmousedown">
<description>The onmousedown property returns the onMouseDown event handler code on the current element.
Syntax: event handling code = element.onMouseDown
The mousedown event is raised when the user presses the left button button.
Specification: DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="onmousemove">
<description>The onmousemove propety returns the onMouseDown event handler code on the current element.
Syntax: event handling code = element.onMouseMove
The mousemove event is raised when the user moves the mouse.
Specification: DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="onmouseout">
<description>The onmouseout property returns the onMouseOut event handler code on the current element.
Syntax: event handling code = element.onMouseOut
The mouseout event is raised when the mouse leaves an element (e.g, when the mouse moves off of an image in the web page, the mouseout event is raised for that image element).
Specification: DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="onmouseover">
<description>The onmouseover property returns the onMouseOver event handler code on the current element.
Syntax: event handling code = element.onmouseover
The mouseover event is raised when the user moves the mouse over a particular element.
Specification: Not part of specification. </description>
</element>
<element kind="var" name="onmouseup">
<description>The onmouseup property returns the onMouseUp event handler code on the current element.
Syntax: event handling code = element.onMouseUp
The mouseup event is raised when the user releases the left mouse button.
Specification: DOM Level 0. Not part of specification. </description>
</element>
<element kind="var" name="onresize">
<description>The onResize property returns the onResize event handler code on the current element.
Syntax: event handling code = element.onresize
The resize event is raised when the user resizes a resizable element (such as a window).
Specification: DOM Level 0. Not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[
// <img src="pawn.gif" onResize="growBoard();" />
function pawnClick() {
i = document.getElementById("img1");
alert(i.onresize);
}
// alerts: function anonymous(event) { growBoard() }
]]></description>
</property>
</properties>
</element>
</group>
</group>
<group name="style">
<note title="Introduction">The basic style object exposes the StyleSheet and the CSSStyleSheet interfaces from the DOM Level 2 Events specification.
Those interfaces contain members like insertRule, selectorText, and parentStyleSheet for accessing and manipulating the individual style rules that make up a CSS stylesheet.
To get to the style objects from the document, you can use the document.styleSheets property and access the individual objects by index (e.g., document.styleSheets[0] is the first stylesheet defined for the document, etc.).
Though there are various syntaxes for expressing stylesheets for a document, Netscape supports CSS exclusively, so the style object retrieved from this array implements both the StyleSheet and CSSStyleSheet interfaces. </note>
<group name="Properties">
<element kind="var" name="style.media">
<description> Specifies the intended destination medium for style information.</description>
</element>
<element kind="var" name="style.type ">
<description>Returns the type of style being applied by this statement.</description>
</element>
</group>
<group name="DOM style Object">
<note title="Introduction">Since the style property represents the style attribute, which has the highest priority in the CSS cascade, it is useful for setting style on an element. However, it is less useful for learning about the element's style, since it represents only the CSS declarations in the style attribute, not those that come from style rules elsewhere.
See the Gecko DOM Reference:
http://developer.mozilla.org/en/docs/Gecko_DOM_Reference:style#DOM_CSS_Properties_List
for a list of the CSS properties that are accessible from the Gecko DOM. There are some additional notes there about the use of the style property to style elements in the DOM.
It is generally better to use the style property than to use setAttribute('style', '...') since use of the style property will not overwrite other CSS properties that are specified in the style attribute.
Specification: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle</note>
</group>
<group name="DOM stylesheet Object">
<note title="Introduction">The stylesheet object represents the stylesheet itself. A stylesheet contains any number of separate rules, which can be manipulated with the cssRule (see DOM cssRule Object below).
Using the stylesheet object, you can add and delete style rules. You can also travel the hierarchy of stylesheets that can be associated with a particular document using the parentStyleSheet property. </note>
<group name="Properties">
<element kind="var" name="stylesheet.cssRules">
<description>Returns all of the CSS rules in the stylesheet as an array.</description>
</element>
<element kind="var" name="stylesheet.disabled">
<description>This property indicates whether the current stylesheet has been applied or not.</description>
</element>
<element kind="var" name="stylesheet.href">
<description>Returns the location of the stylesheet.</description>
</element>
<element kind="var" name="stylesheet.media">
<description>Specifies the intended destination medium for style information.</description>
</element>
<element kind="var" name="stylesheet.ownerNode">
<description>Returns the node that associates this style sheet with the document.</description>
</element>
<element kind="var" name="stylesheet.ownerRule">
<description>If this style sheet comes from an @import rule, the ownerRule property will contain the CSSImportRule. </description>
</element>
<element kind="var" name="stylesheet.parentStyleSheet">
<description>Returns the stylesheet that is including this one, if any.</description>
</element>
<element kind="var" name="stylesheet.title">
<description>Returns the advisory title of the current style sheet.</description>
</element>
<element kind="var" name="stylesheet.type">
<description>Specifies the style sheet language for this style sheet.</description>
</element></group>
<group name="Methods">
<element kind="var" name="stylesheet.deleteRule()">
<description>Deletes a rule from the stylesheet.</description>
</element>
<element kind="var" name="stylesheet.insertRule()">
<description>Inserts a new style rule into the current style sheet.</description>
</element>
</group>
</group>
<group name="DOM cssRule Object">
<note title="Introduction">The cssRule object represents a single CSS style rule. These rules may be a part of a stylesheet or they may be placed in-line with the individual nodes in the HTML or XML document.
Each stylesheet object exposes an array of the cssRules that make it up, and you can also get to the rules on individual elements by using the element.style property.</note>
<group name="Properties">
<element kind="var" name="cssRule.cssText">
<description>cssText returns the actual text of the style rule.</description>
</element>
<element kind="var" name="cssRule.parentStyleSheet">
<description>parentStyleSheet returns the stylesheet object in which the current rule is defined.</description>
</element>
<element kind="var" name="cssRule.selectorText">
<description>selectorText gets/sets the textual representation of the selector for the rule set.</description>
</element>
<element kind="var" name="cssRule.style">
<description>style returns the declaration block for the current style.</description>
</element>
</group>
</group>
<group name="DOM CSS Properties List">
<note title="Introduction">The following is a list of the CSS properties that are supported in the Netscape 6 DOM and accessible by means of the style property on elements.
Styles can be returned or set with the style property and these attributes but that you cannot set values directly using constructions such as style="background-color: blue" from the DOM, where the value is a string that contains both the attribute and the value you wish to set. By itself, the style property should only be used as a "getter" and not a "setter." In other words, the first of the following two constructions is bad, and the latter is better practice in the DOM:
bad
element.style = "background-color: blue";
good
element.style.backgroundColor = "blue";
Note that the bad example above may actually set the background color of the given element, but this assignment overwrites any style information that already existed on that element, and then cannot be added to or updated without other overwrites. The special style attributes available off of the element's style property allow you to "manage" the style of your elements in a safer and more organized way.
See also: the Element style property. You can check the syntax for the values of these attributes by consulting the DOM CSS specification.
</note>
<element kind="var" name="accelerator">
</element>
<element kind="var" name="azimuth">
</element>
<element kind="var" name="background">
</element>
<element kind="var" name="backgroundAttachment">
</element>
<element kind="var" name="backgroundColor">
</element>
<element kind="var" name="backgroundImage">
</element>
<element kind="var" name="backgroundPosition">
</element>
<element kind="var" name="backgroundRepeat">
</element>
<element kind="var" name="border">
</element>
<element kind="var" name="borderBottom">
</element>
<element kind="var" name="borderBottomColor">
</element>
<element kind="var" name="borderBottomStyle">
</element>
<element kind="var" name="borderBottomWidth">
</element>
<element kind="var" name="borderCollapse">
</element>
<element kind="var" name="borderColor">
</element>
<element kind="var" name="borderLeft">
</element>
<element kind="var" name="borderLeftColor">
</element>
<element kind="var" name="borderLeftStyle">
</element>
<element kind="var" name="borderLeftWidth">
</element>
<element kind="var" name="borderRight">
</element>
<element kind="var" name="borderRightColor">
</element>
<element kind="var" name="borderRightStyle">
</element>
<element kind="var" name="borderRightWidth">
</element>
<element kind="var" name="borderSpacing">
</element>
<element kind="var" name="borderStyle">
</element>
<element kind="var" name="borderTop">
</element>
<element kind="var" name="borderTopColor">
</element>
<element kind="var" name="borderTopStyle">
</element>
<element kind="var" name="borderTopWidth">
</element>
<element kind="var" name="borderWidth">
</element>
<element kind="var" name="bottom">
</element>
<element kind="var" name="captionSide">
</element>
<element kind="var" name="clear">
</element>
<element kind="var" name="clip">
</element>
<element kind="var" name="color">
</element>
<element kind="var" name="content">
</element>
<element kind="var" name="counterIncrement">
</element>
<element kind="var" name="counterReset">
</element>
<element kind="var" name="cssFloat">
</element>
<element kind="var" name="cssText">
</element>
<element kind="var" name="cue">
</element>
<element kind="var" name="cueAfter">
</element>
<element kind="var" name="onBefore">
</element>
<element kind="var" name="cursor">
</element>
<element kind="var" name="direction">
</element>
<element kind="var" name="displays">
</element>
<element kind="var" name="elevation">
</element>
<element kind="var" name="emptyCells">
</element>
<element kind="var" name="font">
</element>
<element kind="var" name="fontFamily">
</element>
<element kind="var" name="fontSize">
</element>
<element kind="var" name="fontSizeAdjust">
</element>
<element kind="var" name="fontStretch">
</element>
<element kind="var" name="fontStyle">
</element>
<element kind="var" name="fontVariant">
</element>
<element kind="var" name="fontWeight">
</element>
<element kind="var" name="height">
</element>
<element kind="var" name="left">
</element>
<element kind="var" name="length">
</element>
<element kind="var" name="letterSpacing">
</element>
<element kind="var" name="lineHeight">
</element>
<element kind="var" name="listStyle">
</element>
<element kind="var" name="listStyleImage">
</element>
<element kind="var" name="listStylePosition">
</element>
<element kind="var" name="listStyleType">
</element>
<element kind="var" name="margin">
</element>
<element kind="var" name="marginBottom">
</element>
<element kind="var" name="marginLeft">
</element>
<element kind="var" name="marginRight">
</element>
<element kind="var" name="marginTop">
</element>
<element kind="var" name="markerOffset">
</element>
<element kind="var" name="marks">
</element>
<element kind="var" name="maxHeight">
</element>
<element kind="var" name="maxWidth">
</element>
<element kind="var" name="minHeight">
</element>
<element kind="var" name="minWidth">
</element>
<element kind="var" name="MozBinding">
</element>
<element kind="var" name="MozOpacity">
</element>
<element kind="var" name="orphans">
</element>
<element kind="var" name="outline">
</element>
<element kind="var" name="outlineColor">
</element>
<element kind="var" name="outlineStyle">
</element>
<element kind="var" name="outlineWidth">
</element>
<element kind="var" name="overflow">
</element>
<element kind="var" name="padding">
</element>
<element kind="var" name="paddingBottom">
</element>
<element kind="var" name="paddingLeft">
</element>
<element kind="var" name="paddingRight">
</element>
<element kind="var" name="paddingTop">
</element>
<element kind="var" name="page">
</element>
<element kind="var" name="pageBreakAfter">
</element>
<element kind="var" name="pageBreakBefore">
</element>
<element kind="var" name="pageBreakInside">
</element>
<element kind="var" name="parentRule">
</element>
<element kind="var" name="pause">
</element>
<element kind="var" name="pauseAfter">
</element>
<element kind="var" name="pauseBefore">
</element>
<element kind="var" name="pitch">
</element>
<element kind="var" name="pitchRange">
</element>
<element kind="var" name="playDuring">
</element>
<element kind="var" name="position">
</element>
<element kind="var" name="quotes">
</element>
<element kind="var" name="richness">
</element>
<element kind="var" name="right">
</element>
<element kind="var" name="size">
</element>
<element kind="var" name="speak">
</element>
<element kind="var" name="speakHeader">
</element>
<element kind="var" name="speakNumeral">
</element>
<element kind="var" name="speakPunctuation">
</element>
<element kind="var" name="speechRate">
</element>
<element kind="var" name="stress">
</element>
<element kind="var" name="tableLayout">
</element>
<element kind="var" name="textAlign">
</element>
<element kind="var" name="textDecoration">
</element>
<element kind="var" name="textIndent">
</element>
<element kind="var" name="textShadow">
</element>
<element kind="var" name="textTransform">
</element>
<element kind="var" name="top">
</element>
<element kind="var" name="unicodeBidi">
</element>
<element kind="var" name="verticalAlign">
</element>
<element kind="var" name="visibility">
</element>
<element kind="var" name="voiceFamily">
</element>
<element kind="var" name="volume">
</element>
<element kind="var" name="whiteSpace">
</element>
<element kind="var" name="widows">
</element>
<element kind="var" name="width">
</element>
<element kind="var" name="wordSpacing">
</element>
<element kind="var" name="zIndex">
</element>
</group>
</group>
<group name="event">
<note title="Introduction">
This chapter describes the DOM Level 2 Event Model as implemented by Gecko.
The event object itself is described, as well as the interfaces for event registration on other nodes in the DOM,
event handers and event listeners, and several longer examples that show how the various event interfaces relate to one another.</note>
<group name="Properties">
<element kind="var" name="event.altKey">
</element>
<element kind="var" name="event.bubbles">
</element>
<element kind="var" name="event.cancelable">
</element>
<element kind="var" name="event.cancelBubble">
</element>
<element kind="var" name="event.charCode">
</element>
<element kind="var" name="event.clientX">
</element>
<element kind="var" name="event.clientY">
</element>
<element kind="var" name="event.ctrlKey">
</element>
<element kind="var" name="event.currentTarget">
</element>
<element kind="var" name="event.detail">
</element>
<element kind="var" name="event.eventPhase">
</element>
<element kind="var" name="event.isChar">
</element>
<element kind="var" name="event.keyCode">
</element>
<element kind="var" name="event.layerX">
</element>
<element kind="var" name="event.layerY">
</element>
<element kind="var" name="event.metaKey">
</element>
<element kind="var" name="event.pageX">
</element>
<element kind="var" name="event.pageY">
</element>
<element kind="var" name="event.relatedTarget">
</element>
<element kind="var" name="event.screenX">
</element>
<element kind="var" name="event.screenY">
</element>
<element kind="var" name="event.shiftKey">
</element>
<element kind="var" name="event.target">
</element>
<element kind="var" name="event.timeStamp">
</element>
<element kind="var" name="event.type">
</element>
<element kind="var" name="event.view">
</element>
<element kind="var" name="event.which">
</element>
</group>
<group name="Methods">
<element kind="var" name="event.initEvent()">
</element>
<element kind="var" name="event.initMouseEvent()">
</element>
<element kind="var" name="event.initUIEvent()">
</element>
<element kind="var" name="event.preventDefault()">
</element>
<element kind="var" name="event.stopPropagation()">
</element></group>
</group>
<group name="Form">
<note title="Introduction">As HTML elements, FORM elements expose all of the properties and methods described in the element chapter.
They also expose the specialized interface described here.
</note>
<group name="Properties">
<element kind="var" name="form.elements ">
<description>elements returns an array of all the form controls contained in the FORM element.
Syntax: nodeList = form.elements
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-76728479</description>
<properties>
<property kind="example">
<description><![CDATA[var inputs = document.getElementById("form1").elements;
var inputByIndex = inputs[2];
var inputByName = inputs["login"];
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.length">
<description>length returns the number of controls in the FORM element.
Syntax: integer = form.length
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[if (document.getElementById("form1").length > 1) {
// more than one form control here
}]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.name">
<description>name returns the name of the current FORM element as a string.
Syntax: string = form.name form.name = string
Note that this property is read/write, which means that you can change the name of a form or set it if it hasn't been set already.
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[form1 = document.getElementById("form1").name;
if (form1 != document.form.form1) {
// browser doesn't support this form of reference
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.acceptCharset">
<description>acceptCharset returns a list of the supported character encodings for the given FORM element. This list can be comma- or space-separated.
Syntax: string = form.acceptCharset;
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[inputs = document.forms["myform"].acceptCharset
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.action">
<description>action gets/sets the action of the FORM element.
Syntax: string = form.action form.action = string
The action of a form is the program that is executed on the server when the form is submitted. This property can be retrieved or set.
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
</element>
<element kind="var" name="form.enctype">
<description>enctype gets/sets the content type of the FORM element.
Syntax: string = form.enctype form.enctype = string
The encoding type is generally "application/x-www-form-urlencoded".
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[form.enctype = "application/x-www-form-urlencoded";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.encoding">
<description>encoding is an alternative name for the enctype element on the DOM FormElement object.</description>
</element>
<element kind="var" name="form.method">
<description>method gets/sets the HTTP method used to submit the form.
Syntax: string = form.method form.method = string
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[document.forms["myform"].method = "POST";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.target">
<description>target gets/sets the target of the action (i.e., the frame to render its output in).
Syntax: string = form.target form.target = string
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[myForm.target = document.frames[1].name;
]]></description>
</property>
</properties>
</element>
</group>
<group name="Methods">
<element kind="var" name="form.submit()">
<description>submit submits the form.
Syntax: form.submit()
This method does the same thing as clicking the form submit button.
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[document.forms["myform"].submit()
]]></description>
</property>
</properties>
</element>
<element kind="var" name="form.reset()">
<description>reset resets the form to its initial state.
Syntax: form.reset()
This method is the same as the form reset button.
Specification: http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011025/html.html#ID-40002357</description>
<properties>
<property kind="example">
<description><![CDATA[document.forms["myform"].reset();
]]></description>
</property>
</properties>
</element>
</group>
</group>
<group name="Table">
<note title="Introduction">table objects expose the HTMLTableElement interface,
which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance)
for manipulating the layout and presentation of tables in HTML.</note>
<group name="Properties">
<element kind="var" name="table.align">
<description>align gets/sets the alignment of the table.
Syntax: alignment = table.align table.align = alignment
Parameters: alignment is a string with one of the following values: left center right
The align attribute is deprecated in HTML4.0.</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.align = "center";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.bgColor">
<description>bgcolor gets/sets the background color of the table.
Syntax: color = table.bgColor table.bgColor = color
Parameters: color is a string representing a color value.
The bgColor attribute is deprecated in HTML 4.0.</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.bgColor = "lightblue";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.border">
<description>border gets/sets the border width.
Syntax: table.border = pixel_string pixel_string = table.border
This attribute is deprecated in HTML 4.0.</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.border="2";
]]></description>
</property>
</properties>
</element>
<element kind="var" name=" table.caption">
<description>caption returns the table caption.
Syntax: string = table.caption
This property returns void if no caption exists on the table.</description>
<properties>
<property kind="example">
<description><![CDATA[if (table.caption) {
// do something with the caption
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.cellPadding">
<description>cellPadding gets/sets the padding around the individual cells of the table.
Syntax: table.cellPadding = pixel_string pixel_string = table.cellPadding</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.cellPadding = "10";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.cellSpacing">
<description>cellSpacing gets/sets the spacing around the individual cells of the table.
Syntax: table.cellSpacing = pixel_string pixel_string = table.cellSpacing</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.cellSpacing = "10";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.frame">
<description>frame specifies which external table borders to render.
Syntax: table.frame = side side = table.frame
Parameters: side is a string with one of the following values:
void
no sides. this is the default.
above
top side
below
bottom side
hsides
top and bottom only
vsides
right and left sides only
lhs
left-hand side only
rhs
right-hand side only
box
all four sides
border
all four sides</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.frame = "border";
mytable.border = "2px";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.rows">
<description>rows returns a collection of the rows in the table.
Syntax: HTMLCollectionObject = table.rows
The collection returned by this property includes the THEAD and TFOOT and TBODY elements, if any, on the current table.</description>
<properties>
<property kind="example">
<description><![CDATA[myrows = mytable.rows;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.rules">
<description>rules specifies which cell borders to render in the table.
Syntax: table.rules = rules rules = table.rules
Parameters: rules is a string with one of the following values:
none
no rules
groups
lines between groups only
rows
lines between rows
cols
lines between cols
all
lines between all cells</description>
<properties>
<property kind="example">
<description><![CDATA[t = document.getElementById("mytable");
t.rules = "all";
// turn on all the internal borders
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.summary">
<description>summary gets/sets a table description.
Syntax: table.summary = string string = table.summary</description>
<properties>
<property kind="example">
<description><![CDATA[t.rules = "none";
t.summary = "removed internal borders";
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.tBodies">
<description>tBodies returns a collection of the table bodies.
Syntax: HTMLCollectionObject = table.tBodies</description>
<properties>
<property kind="example">
<description><![CDATA[length(mytable.tBodies);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.tFoot">
<description>tFoot returns the table's TFOOT element.
Syntax: HTMLTableSectionElementObject = table.tFoot
This property returns VOID if no TFOOT element exists.</description>
<properties>
<property kind="example">
<description><![CDATA[if (table.tFoot == my_foot) {
...
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.tHead">
<description>tHead returns the table's THEAD.
Syntax: th_el = table.tHead
Parameters: th_el is a HTMLTableSectionElement.
This property returns VOID if no THEAD element exists.</description>
<properties>
<property kind="example">
<description><![CDATA[if (table.tHead == my_head_el) {
...
}
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.width">
<description>width specifies the desired width of the table.
Syntax: table.width = width width = table.width
Specification: http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-77447361</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.width = "75%";
]]></description>
</property>
</properties>
</element>
</group>
<group name="Methods">
<element kind="var" name="table.createTHead()">
<description>createTHead creates a new THEAD for the table.
Syntax: HTMLElementObject = table.createTHead()
If the element already exists on the table, then this method returns that element.</description>
<properties>
<property kind="example">
<description><![CDATA[myhead = mytable.createTHead();
//checking: myhead == mytable.tHead
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.deleteTHead()">
<description>deleteTHead removes a THEAD from the table.
Syntax: table.deleteTHead()</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.deleteTHead();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.createTFoot()">
<description>createTFoot creates a new TFOOT for the table.
Syntax: HTMLElementObject = table.createTFoot()
If the element already exists on the table, then this method returns that element</description>
<properties>
<property kind="example">
<description><![CDATA[myfoot = mytable.createTFoot();
//checking: myfoot == mytable.tFoot
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.deleteTFoot()">
<description>deleteTFoot removes a TFOOT from the table.
Syntax: table.deleteTFoot()</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.deleteTFoot();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.createCaption()">
<description>createCaption creates a new caption for the table.
Syntax: HTMLElementObj = table.createCaption()
If the element already exists on the table, then this method returns that element.</description>
<properties>
<property kind="example">
<description><![CDATA[mycap = mytable.createCaption();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.deleteCaption()">
<description>deleteCaption removes the caption from the table.
Syntax: table.deleteCaption()</description>
</element>
<element kind="var" name="table.insertRow()">
<description>insertRow inserts a new row in the table.
Syntax: row = table.insertRow(index)
Parameters: index is a number representing where in the table to insert the new row.
row is an HTMLElement.</description>
<properties>
<property kind="example">
<description><![CDATA[newrow = mytable.insertRow(0);
// insert a new first row
]]></description>
</property>
</properties>
</element>
<element kind="var" name="table.deleteRow()">
<description>deleteRow removes a row from the table.
Syntax: table.deleteRow(index)
Parameters: index is a number representing the row that should be deleted.</description>
<properties>
<property kind="example">
<description><![CDATA[mytable.deleteRow(1);
// delete the second row
]]></description>
</property>
</properties>
</element>
</group>
</group>
<group name="range"><note title="Introduction">
The Range object represents a fragment of a document that can contain nodes and parts of text nodes in a given document.
A range can be created using the createRange method of the document object.
Range objects can also be retrieved by using the getRangeAt method of the selection object.</note>
<group name="Properties">
<element kind="var" name="collapsed">
<description>Returns a boolean indicating whether the range's start and end points are at the same position.
Syntax: isCollapsed = range.collapsed;
Returns a boolean of true if the start and end boundary points of the Range are the same point in the DOM, false if not.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-collapsed</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
isCollapsed = range.collapsed;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="commonAncestorContainer">
<description>Returns the deepest Node that contains the startContainer and endContainer Nodes.
Syntax: rangeAncestor = range.commonAncestorContainer;
Returns the deepest, or further down the document tree, Node that contains both the startContainer and endContainer nodes. Since a Range need not be continuous, and may also partially select Nodes, this is a convenient way to find a Node which encloses a Range.
This property is read-only. To change the ancestor container of a Node, consider using the various methods to set the start and end positions of the Range.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-commonParent</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
rangeAncestor = range.commonAncestorContainer;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="endContainer">
<description>Returns the Node within which the Range ends.
Syntax: endRangeNode = range.endContainer;
Returns a reference to the Node in the document within which the Range ends. This property is read-only. To change the end position of a node, use the setEnd method or a similar method.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-endParent</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
endRangeNode = range.endContainer;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="endOffset">
<description>Returns a number representing where in the endContainer the Range ends.
Syntax: endRangeOffset = range.endOffset;
endOffset has two meanings. If the endContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the endContainer to the boundary point of the Range. For other Node types, the endOffset is the number of child nodes between the start of the endContainer and the boundary point of the Range. This property is read-only. To change the endOffset of a Range, use one of the setEnd methods.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-endOffset</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
endRangeOffset = range.endOffset;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="startContainer">
<description>Returns the Node within which the Range starts.
Syntax: startRangeNode = range.startContainer;
Returns a reference to the Node in the document within which the Range starts. This property is read-only. To change the start position of a node, use one of the setStart methods.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-startParent</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
startRangeNode = range.startContainer;
]]></description>
</property>
</properties>
</element>
<element kind="var" name="startOffset">
<description>Returns a number representing where in the startContainer the Range starts.
Syntax: startRangeOffset = range.startOffset;
startOffset has two meanings. If the startContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the startContainer to the boundary point of the Range. For other Node types, the startOffset is the number of child nodes between the start of the startContainer and the boundary point of the Range. This property is read-only. To change the startOffset of a Range, use one of the setStart methods.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-attr-startOffset</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
startRangeOffset = range.startOffset;
]]></description>
</property>
</properties>
</element>
</group>
<group name="Positioning Methods">
<element kind="var" name="setStart()">
<description>Sets the start position of a Range.
Syntax: range.setStart(startNode,startOffset);
Parameters: startNode The Node to start the Range startOffset An integer greater than or equal to zero representing the offset for the start of the Range from the start of startNode.
If the startNode is a Node of type Text, Comment, or CDATASection, then startOffset is the number of characters from the start of startNode. For other Node types, startOffset is the number of child nodes between the start of the startNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-setStart</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
startNode = document.getElementsByTagName("p").item(2);
startOffset = 0;
range.setStart(startNode,startOffset);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setEnd()">
<description>Sets the end position of a Range.
Syntax: range.setEnd(endNode,endOffset);
Parameters: endNode The Node to end the Range endOffset An integer greater than or equal to zero representing the offset for the end of the Range from the start of endNode.
If the endNode is a Node of type Text, Comment, or CDATASection, then endOffset is the number of characters from the start of endNode. For other Node types, endOffset is the number of child nodes between the start of the endNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-setEnd</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
endNode = document.getElementsByTagName("p").item(3);
endOffset = document.getElementsByTagName("p").item(3).childNodes.length;
range.setEnd(endNode,endOffset);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setStartBefore()">
<description>Sets the start position of a Range relative to another Node.
Syntax: range.setStartBefore(referenceNode);
Parameters: referenceNode The Node to start the Range before
The parent Node of the start of the Range will be the same as that for the referenceNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-setStartBefore</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.setStartBefore(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setStartAfter()">
<description>Sets the start position of a Range relative to another Node.
Syntax: range.setStartAfter(referenceNode);
Parameters: referenceNode The Node to start the Range after
The parent Node of the start of the Range will be the same as that for the referenceNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-setStartAfter</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.setStartAfter(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setEndBefore()">
<description>Sets the end position of a Range relative to another Node.
Syntax: range.setEndBefore(referenceNode);
Parameters: referenceNode The Node to end the Range before
The parent Node of end of the Range will be the same as that for the referenceNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-setEndBefore</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.setEndBefore(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="setEndAfter()">
<description>Sets the end position of a Range relative to another Node.
Syntax: range.setEndAfter(referenceNode);
Parameters: referenceNode The Node to end the Range after
The parent Node of end of the Range will be the same as that for the referenceNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-setEndAfter</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.setEndAfter(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="selectNode()">
<description>Sets the Range to contain the node and its contents.
Syntax: range.selectNode(referenceNode);
Parameters: referenceNode The Node to select within a Range
The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-selectNode</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.selectNode(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="selectNodeContents()">
<description>Sets the Range to contain the contents of a Node.
Syntax: range.selectNodeContents(referenceNode);
Parameters: referenceNode The Node whose contents will be selected within a Range
The parent Node of the start and end of the Range will be the referenceNode. The startOffset is 0, and the endOffset is the number of child Nodes or number of characters contained in the reference node.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-selectNodeContents</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.selectNodeContents(referenceNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="collapse()">
<description>Collapses the Range to one of its boundary points.
Syntax: range.collapse(toStart);
Parameters: toStart A boolean, true collapses the Range to its start, false to its end.
A collapsed Range is empty, containing no content, specifying a single-point in a DOM tree. To determine if a Range is already collapsed, see the collapsed property.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-collapse</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
referenceNode = document.getElementsByTagName("div").item(0);
range.selectNode(referenceNode);
range.collapse(true);
]]></description>
</property>
</properties>
</element>
</group>
<group name="Editing Methods">
<element kind="var" name="cloneContents()">
<description>Returns a document fragment copying the nodes of a Range.
Syntax: documentFragment = range.cloneContents();
Event Listeners added using DOM Events are not copied during cloning. HTML attribute events are duplicated as they are for the DOM Core cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document through cloning.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level2-Range-method-cloneContents</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
documentFragment = range.cloneContents();
document.body.appendChild(documentFragment);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="deleteContents()">
<description>Removes the contents of a Range from the document.
Syntax: range.deleteContents()
Unlike extractContents, this method does not return a documentFragment containing the deleted content.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level2-Range-method-deleteContents</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="extractContents()">
<description>Moves contents of a Range from the document tree into a document fragment.
Syntax: documentFragment = range.extractContents();
Event Listeners added using DOM Events are not retained during extraction. HTML attribute events are retained or duplicated as they are for the DOM Core cloneNode method. HTML id attributes are also cloned, which can lead to an invalid document if a partially-selected node is extracted and appened to the document.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level2-Range-method-extractContents</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
documentFragment = range.extractContents();
document.body.appendChild(documentFragment);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="insertNode()">
<description>Insert a node at the start of a Range.
Syntax: range.insertNode(newNode);
Parameters: newNode is a Node.
newNode is inserted at the start boundary point of the Range. If the newNodes is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text Nodes (Blocked by http://bugzilla.mozilla.org/show_bug.cgi?id=135922 )
If newNode is a document fragment, the children of the document fragment are inserted instead.
Specification: http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level2-Range-method-insertNode</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
newNode = document.createElement("p"):
newNode.appendChild(document.createTextNode("New Node Inserted Here"));
range.selectNode(document.getElementsByTagName("div").item(0));
range.insertNode(newNode);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="surroundContents()">
<description>Moves content of a Range into a new node.
Syntax: range.surroundContents(newNode);
Parameters: newNode a Node
surroundContents is equivalent to newNode.appendChild(range.extractContents());range.insertNode(newNode). After surrounding, the boundary points of the Range include newNode. (Previously hindered by bug 135928 )
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-surroundContents</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
newNode = document.createElement("p"):
range.selectNode(document.getElementsByTagName("div").item(0));
range.surroundContents(newNode);
]]></description>
</property>
</properties>
</element>
</group>
<group name="Other Methods">
<element kind="var" name="compareBoundaryPoints()">
<description>Compares the boundary points of two Ranges.
Syntax: compare = range.compareBoundaryPoints(how, sourceRange);
Any of the following constants can be passed as the value of how parameter:
Range.END_TO_END compares the end boundary-point of sourceRange to the end boundary-point of range.
Range.END_TO_START compares the end boundary-point of sourceRange to the start boundary-point of range.
Range.START_TO_END compares the start boundary-point of sourceRange to the end boundary-point of range.
Range.START_TO_START compares the start boundary-point of sourceRange to the start boundary-point of range.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-compareBoundaryPoints</description>
<properties>
<property kind="example">
<description><![CDATA[var range, sourceRange, compare;
range = document.createRange();
range.selectNode(document.getElementsByTagName("div")[0]);
sourceRange = document.createRange();
sourceRange.selectNode(document.getElementsByTagName("div")[1]);
compare = range.compareBoundaryPoints(START_TO_END, sourceRange);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="cloneRange()">
<description>Returns a Range object with boundary points identical to the cloned Range.
Syntax: clone = range.cloneRange();
clone is copied by value, not reference, so a change in either Range does not effect the other.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-clone</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
clone = range.cloneRange();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="detach()">
<description>Releases Range from use to improve performance.
Syntax: range.detach();
Allows mozilla to relinquish resources associated with this Range. Subsequent attempts to use the detached range will result in a DOMException being thrown with an error code of INVALID_STATE_ERR.
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-detach</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.detach();
]]></description>
</property>
</properties>
</element>
<element kind="var" name="toString()">
<description>Returns the text of the Range.
Syntax: text = range.toString();
Alerting the contents of a Range makes an implicit toString() call, so comparing range and text through an alert dialog is ineffective
Specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level2-Range-method-toString</description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
text = range.toString();
]]></description>
</property>
</properties>
</element>
</group>
<group name="Gecko Methods">
<element kind="var" name="compareNode()">
<description>Returns a constant (see notes).
Syntax: returnValue = range.compareNode( referenceNode );
Parameters: referenceNode The Node to compare with the Range.
Method returns one of this constants:
Specification: This method is not part of specification. </description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
returnValue = range.compareNode(document.getElementsByTagName("p").item(0));
]]></description>
</property>
</properties>
</element>
<element kind="var" name="comparePoint()">
<description>Returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the range.
Syntax: returnValue = range.comparePoint( referenceNode, offset )
Parameters: referenceNode The Node to compare with the Range. offset An integer greater than or equal to zero representing the offset inside the referenceNode.
If the referenceNode is a Node of type Text, Comment, or CDATASection, then offset is the number of characters from the start of referenceNode. For other Node types, offset is the number of child nodes between the start of the referenceNode.
Specification: This method is not part of a specification. </description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
returnValue = range.comparePoint(document.getElementsByTagName("p").item(0),1);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="createContextualFragment()">
<description>Returns a document fragment.
Syntax: documentFragment = range.createContextualFragment( tagString )
Parameters: tagString Text that contains text and tags to be converted to a document fragment.
This method takes a string and uses mozilla's parser to convert it to a DOM tree.
Specification: This method is not part of a specification. </description>
<properties>
<property kind="example">
<description><![CDATA[var tagString = "<div>I am a div node</div>";
var range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
var documentFragment = range.createContextualFragment(tagString);
document.body.appendChild(documentFragment);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="intersectsNode()">
<description>Returns a boolean indicating whether the given node intersects the range.
Syntax: bool = range.intersectsNode( referenceNode )
Parameters: referenceNode The Node to compare with the Range.
no notes
Specification: This method is not part of a specification. </description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
bool = range.intersectsNode(document.getElementsByTagName("p").item(0),1);
]]></description>
</property>
</properties>
</element>
<element kind="var" name="isPointInRange()">
<description>Returns a boolean indicating whether the given point is in the range.
Syntax: bool = range.intersectsNode( referenceNode )
Parameters: referenceNode The Node to compare with the Range.
no notes
Specification: This method is not part of a specification. </description>
<properties>
<property kind="example">
<description><![CDATA[range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
bool = range.intersectsNode(document.getElementsByTagName("p").item(0),1);
]]></description>
</property>
</properties>
</element>
</group>
</group>
</ref>
|