javascript whiteSpace attribute


  Translation results:

white

英[waɪt] 美[hwaɪt, waɪt]

adj. White, pure; colorless, transparent; white; Caucasian

n. white; Caucasian; blank; white pigment

vt. (writing, printing, etc.) to leave a blank space; to make it white, to whiten it; to bleach it

Third person singular: whites Plural: whites Present participle: whiting Past tense: whited Past participle: whited Comparative: whiter Superlative: whitest

space

英[speɪs] 美[spes]

n. Space, space; blank, interval; gap; moment

vt. Separate..., leave a gap between...

vi. Arrange at certain intervals

Third person singular: spaces Plural: spaces Present participle: spacing Past tense: spaced Past participle: spaced

javascript whiteSpace attributesyntax

Function: Set how to handle whitespace characters in text (such as spaces and newlines).

Syntax: Object.style.whiteSpace=normal|nowrap|pre

javascript whiteSpace attributeexample

<html>
<head>
<script type="text/javascript">
function removeWrapping()
{
document.getElementById("div1").style.whiteSpace="nowrap";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="removeWrapping()" 
value="Do not let the text wrap" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A