How to make the Default focus in content page from master page

后端 未结 6 1894
我在风中等你
我在风中等你 2021-01-07 07:57

I have masterpage with content place holder. i have contentpage which is using master page . in all my content page i need to default focus on the text b

6条回答
  •  梦谈多话
    2021-01-07 08:04

    Indiscriminate JavaScript approach to selecting the first valid input field on a page:

    function SelectFirstInput() {
        var bFound = false;
        for (f = 0; f < document.forms.length; f++) {
            // for each element in each form
            for (i = 0; i < document.forms[f].length; i++) {
                // if it's not a hidden element
                if (document.forms[f][i].type != "hidden") {
                    // and it's not disabled
                    if (document.forms[f][i].disabled != true) {
                        // set the focus to it
                        document.forms[f][i].focus();
                        var bFound = true;
                    }
                }
                // if found in this element, stop looking
                if (bFound == true)
                    break;
            }
            // if found in this form, stop looking
            if (bFound == true)
                break;
        }
    }
    

提交回复
热议问题