Home  >  Article  >  Web Front-end  >  HTML object: introduction to some object properties of html

HTML object: introduction to some object properties of html

不言
不言Original
2018-08-09 15:16:442508browse

The content of this article is about HTML objects: an introduction to some object attributes of html, which has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Form object

Form object method

reset(): Resets all input elements of the form to their default values.

submit(): Submit the form.

Text object

Text object property

disabled: Sets or returns whether the text field should be disabled.

readOnly: Sets or returns whether the text field should be read-only.

value: Set or return the value of the value attribute of the text field.

Text object method

focus(): Set focus on the text field.

Example



    
        
        
    

Radio object

Radio object property

checked: Sets or returns the status of the radio button.

disabled: Sets or returns whether the radio button is disabled.

value: Sets or returns the value of the radio button's value attribute.

Checkbox object

Checkbox object property

checked: Sets or returns whether the checkbox should be checked.

disabled : Sets or returns whether the checkbox should be disabled.

value: Set or return the value of the value attribute of the checkbox

Select object

Select object collection

options[]: Returns an array containing all options in the drop-down list.

Select object property

disabled: Sets or returns whether the drop-down list should be disabled.

length: Returns the number of options in the drop-down list.

selectedIndex: Set or return the index number of the selected item in the drop-down list.

Select object method

add(): Add an option to the drop-down list.

remove(): Remove an option from the drop-down list.

Option object

Option object construction method

Option(text,value): Create an Option object through text and value values

Option Object Attribute

selected: Set or return the value of the selected attribute.

text: Sets or returns the plain text value of an option.

value: Set or return the value sent to the server.

Select object and Option object example



    
        
        
    

Registry

76c82f278ac045591c9159d381de2c57
100db36a723c770d327fc0aef2ce13b1
    93f0f5c25f18dab9d176bd4f6de5d30e
        a80eb7cbb6fff8b0ff70bae37074b813
        b2386ffb911b14667cb8f0f91ea547a76e916e0f7d1e588d4f442bf645aedb2f
    9c3bca370b5104690d9ef395f2c5f8d1
    6c04bd5ca3fcae76e30b72ad730ca86d
        adaa35323c0e774c3401f5eeaad021b854bdf357c58b8a65c66d7c19c8e4d114ff9d32c555bb1d9133a29eb4371c1213
        a3c38c5df3bd0ef801eff20f09d68ae6
            f5d188ed2c074f8b944552db028f98a1
                a34de1251f0d9fe1e645927f19a896e8
                    b6c5a531a458a2e790c1fd6421739d1c用户名:b90dd5946f0946207856a8a37f441edf
                    b6c5a531a458a2e790c1fd6421739d1c66677a7cbdbf26f5b4be8dede2fe353db90dd5946f0946207856a8a37f441edf
                fd273fcf5bcad3dfdad3c41bd81ad3e5
                a34de1251f0d9fe1e645927f19a896e8
                    b6c5a531a458a2e790c1fd6421739d1c密码:b90dd5946f0946207856a8a37f441edf
                    b6c5a531a458a2e790c1fd6421739d1c9589aa3b033daf74e59b78a53d583ed9b90dd5946f0946207856a8a37f441edf
                fd273fcf5bcad3dfdad3c41bd81ad3e5
                a34de1251f0d9fe1e645927f19a896e8
                    b6c5a531a458a2e790c1fd6421739d1c确认密码:b90dd5946f0946207856a8a37f441edf
                    b6c5a531a458a2e790c1fd6421739d1c6d13c2159bf38342899a7d768b94f482b90dd5946f0946207856a8a37f441edf
                fd273fcf5bcad3dfdad3c41bd81ad3e5
            f16b1740fad44fb09bfe928bcc527e08
            3ea5dbfd399b8f71042a18725f567918男
            ad881942639cffcc4579c376971b3fd0女
            ff9d32c555bb1d9133a29eb4371c1213
            d1e0b01b1506f8728873336b6865bf7a羽毛球
            3e539ce442c5e67a6c62e8a5c36157f9篮球
            ebae056c174c155368d696d5878bbb83乒乓球
            a33e9cbdec54ff9234e2ba5d2597fa26足球
            ff9d32c555bb1d9133a29eb4371c1213
            f37074c1351f94297e4cf97b2ab2681e
                859be17dfcd6af2d26185135fb5bd8fc大一4afa15d3069109ac30911f04c56f3338
                656b9f2e82088a1bf3f244445950414e大二4afa15d3069109ac30911f04c56f3338
                9403fa44e4282955565dbaeb33a85ca2大三4afa15d3069109ac30911f04c56f3338
                0df899068b02ff57e98d12c8174c0b32大四4afa15d3069109ac30911f04c56f3338
            18bb6ffaf0152bbe49cd8a3620346341
            ff9d32c555bb1d9133a29eb4371c1213
            b6c5a531a458a2e790c1fd6421739d1c3f1a3b04c1bd97ce66681e2e90414dc0b90dd5946f0946207856a8a37f441edf
            b6c5a531a458a2e790c1fd6421739d1cc3086de9e33a2a167c44c4932c789135b90dd5946f0946207856a8a37f441edf
        f5a47148e367a6035fd7a2faa965022e
        3f1c4e4b6b16bbbd69b2ee476dc4f83a
            //使用$()函数可节省代码量
            function $(id){
                return document.getElementById(id);
            }

            function check(){
                var n = document.getElementById("name");
                var w = document.getElementById("pw");
                var msg = document.getElementById("wrong-massage");
                var c = document.getElementById("pw-check");

                if(n.value.length>12){
                    msg.innerHTML = "用户名不能超过15个字符,请重新输入!";
                    n.focus();
                    return false;
                }
                if(n.value.length==0){
                    msg.innerHTML = "用户名不能为空,请重新输入!";
                    n.focus();
                    return false;
                }
                if(w.value.length>12){
                    msg.innerHTML = "密码不能超过12个字符,请重新输入!";
                    w.focus();
                    return false;
                }
                if(w.value.length==0){
                    msg.innerHTML = "密码不能为空,请重新输入!";
                    w.focus();
                    return false;
                }
                if(w.value!=c.value){
                    msg.innerHTML = "密码错误,请重新输入!";
                    c.focus();
                    return false;
                }

                var sex = document.getElementsByName("sex");
                var hobby = document.getElementsByName("hobby");
                for(var i=0;i515c4b6db14d7592195e587d6086cf6312){
                    msg.innerHTML = "用户名不能超过15个字符,请重新输入!";
                    n.value = "";
                    n.focus();
                }
                else if(n.value.length==0){
                    msg.innerHTML = "用户名不能为空,请重新输入!";
                    n.focus();
                }
                else{
                    msg.innerHTML = " ";
                }
            }
            function check_pw(){
                var w = document.getElementById("pw");
                var msg = document.getElementById("wrong-massage");

                if(w.value.length>12){
                    msg.innerHTML = "密码不能超过12个字符,请重新输入!";
                    w.value = "";
                    w.focus();
                }
                else if(w.value.length==0){
                    msg.innerHTML = "密码不匹配,请重新输入!";
                    w.focus();
                }
                else
                {
                    msg.innerHTML = " ";
                }
            }
        2cacc6d41bbb37262a98f745aa00fbf0
    36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

Image object

Image object properties

src: Set or return the URL of the image.

related suggestion:




The above is the detailed content of HTML object: introduction to some object properties of html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn