JavaScript Strike method
The Strike method returns a string that uses the strikethrough style defined by the HTML strike Tag property. The syntax is as follows:
Copy Code code as follows:
Hint: This method does not conform to ECMA standard, do not recommend to use.
Strike Method Instance
Copy Code code as follows:
<script language= "JavaScript" >
var str = "Www.jb51.net";
document.write (Str.strike ("http://www.jb51.net"));
</script>
Run the example and output:
Copy Code code as follows:
Tip: This method returns a strikethrough string defined using the HTML strike tag, which means that the string cannot be changed directly to a string with a strikethrough. If you want to dynamically change the element font to a string with a strikethrough, refer to the following example:
Add decorative effects to the font text (strikethrough, underline, underline, blink)
Copy Code code as follows:
<script language= "JavaScript" >
function Changfont (x) {
document.getElementById ("article"). Style.textdecoration = x;
}
</script>
<body>
<p>
<a onclick= "Changfont (' none ');" > No decoration </a> <a onclick= "Changfont (' Line-through ');" > Delete line </a>
<a onclick= "Changfont (' underline ');" > Underline </a> <a onclick= "Changfont (' overline ');" > Underline </a>
</p>
<p id= "article" >
I am some words ... <br/>
Some Text ...
</p>
</body>