JavaScript Tutorial/Style/textDecoration — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:24, 26 мая 2010
Change element textDecoration: line-through
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function addunderline()
{
head1.style.textDecoration = "underline"
}
function removeunderline()
{
head1.style.textDecoration = "none"
}
function addoverline()
{
head1.style.textDecoration = "overline"
}
function addlinethrough()
{
head1.style.textDecoration = "line-through"
}
// -->
</script>
</head>
<body>
<h1 id="head1" onMouseover="addunderline()" onMouseout="removeunderline()"
onClick="addoverline()" ondblclick="addlinethrough()">Welcome to this page!</h1>
<P>A lot of interesting text goes here!</p>
</body>
</html>
Change element textDecoration: underline, none, overline
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function addunderline()
{
head1.style.textDecoration = "underline"
}
function removeunderline()
{
head1.style.textDecoration = "none"
}
function addoverline()
{
head1.style.textDecoration = "overline"
}
// -->
</script>
</head>
<body>
<h1 id="head1" onMouseover="addunderline()" onMouseout="removeunderline()"
onClick="addoverline()">Welcome to this page!</h1>
<P>A lot of interesting text goes here!</p>
</body>
</html>
div.style.textDecoration="underline";
<html>
<head>
<title>PrettyPretty</title>
<script type="text/javascript">
document.onclick=changeElement;
function changeElement() {
var div = document.getElementById("div1");
div.style.backgroundColor="#00f";
div.style.width="500px";
div.style.color="#fff";
div.style.height="200px";
div.style.paddingLeft="50px";
div.style.paddingTop="50px";
div.style.fontFamily="Verdana";
div.style.fontSize="2em";
div.style.border="3px dashed #ff0";
div.style.position="absolute";
div.style.left="200px";
div.style.top="100px";
div.style.textDecoration="underline";
}
</script>
</head>
<body>
<div id="div1">
This is a DIV element. Click me to see the change.
</div>
</body>
</html>