当城市有一个词时,我的JS很好:
但是当它的时候
我怎样才能成为圣地亚哥?
function convert_case() {
document.profile_form.city.value =
document.profile_form.city.value.substr(0,1).toUpperCase() +
document.profile_form.city.value.substr(1).toLowerCase();
}
Run Code Online (Sandbox Code Playgroud) 这是我的HTML:
<a href="#" class="link">small caps</a> &
<a href="#" class="link">ALL CAPS</a>
Run Code Online (Sandbox Code Playgroud)
这是我的CSS:
.link {text-transform: capitalize;}
Run Code Online (Sandbox Code Playgroud)
输出是:
Small Caps & ALL CAPS
Run Code Online (Sandbox Code Playgroud)
我希望输出为:
Small Caps & All Caps
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我想把句子的第一个字母大写,如果可能的话,还要用逗号后面的第一个字母.我想在这里添加代码:
.qcont {
width: 550px;
height: auto;
float: right;
overflow: hidden;
position: relative;
}
Run Code Online (Sandbox Code Playgroud)