JavaScript strike method
The strike method returns a string of strikethrough styles defined using the HTML strike tag attribute. The syntax is as follows:
The code copy is as follows:
str_object.strike()
Tip: This method does not comply with ECMA standards and is not recommended for use.
Strike method example
The code copy is as follows:
<script language="JavaScript">
var str = "www.VeVB.COM";
document.write( str.strike( "//www.VeVB.COM" ) );
</script>
Run this example and output:
The code copy is as follows:
www.VeVB.COM
Tip: This method returns a strikethrough string defined using the HTML strike tag, that is, using this method cannot directly change the string to a strikethrough string. If you want to dynamically change the element font to a string with a strikethrough, you can refer to the following example:
Add decorative effects to font text (detack, underline, upline, flash)
The code copy is as follows:
<html>
<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');">Strike-up</a>
<a onClick="changFont('underline');">Underline</a> <a onClick="changFont('overline');">Underline</a>
</p>
<p id="article">
I'm some text...<br />
Some Text ...
</p>
</body>
</html>