propriété HTML DOM style textTransform
Définition et utilisation
ensembles de propriétés textTransform ou renvoie le texte de l'affaire.
grammaire
Définition des propriétés de textTransform:
Object.style.textTransform="none|capitalize|uppercase|lowercase|inherit"
Retour propriétés textTransform:
Object.style.textTransform
值 | 描述 |
---|---|
none | 默认。没有被转换的字符。 |
capitalize | 每个单词的首字符转换为大写。 |
uppercase | 所有字符都转换为大写。 |
lowercase | 所有字符都转换为小写。 |
inherit | textTransform 属性的值从父元素继承。 |
support du navigateur
Tous les principaux navigateurs prennent en charge la propriété de textTransform.
Note: IE7 et les versions antérieures ne supportent pas la valeur "inherit".IE8 ne fournit DOCTYPE! Supporté "inherit". soutien IE9 "inherit".
Exemples
Exemples
La première lettre de chaque mot en majuscule:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textTransform="capitalize";
}
</script>
</head>
<body>
<p id="p1">This is some text.</p>
<br>
<button type="button" onclick="displayResult()">转换文本首字符为大写</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textTransform="capitalize";
}
</script>
</head>
<body>
<p id="p1">This is some text.</p>
<br>
<button type="button" onclick="displayResult()">转换文本首字符为大写</button>
</body>
</html>
Essayez »
style Objets