JavaScript String strike() 方法

  • JavaScript String strike() 方法

    strike()方法不是标准方法,并且可能无法在所有浏览器中按预期工作。strike()方法用于显示被删除的字符串。此方法返回嵌入在<strike>标记中的字符串,如下所示:
    <strike>字符串</strike>
    HTML5中不支持<strike>标记。请改用CSS。
    实例:
    显示一个被删除的字符串:
    var str = "Hello World!";
    var result = str.strike();
    
    尝试一下
  • 浏览器支持

    IE/Edge Chrome FireFox Safari Opera
    方法
    strike()
    支持
    支持
    支持
    支持
    支持
  • 语法

    string.strike()
  • 参数值

    参数 描述
    没有
  • 技术细节

    项目 描述
    返回值: 嵌入在<strike>标记中的字符串
    JavaScript版本: ECMAScript 1
  • 更多例子

    相关方法的演示:
    var txt = "Hello World!";
    
    document.write("The original string: " + txt);
    document.write("<p>Big: " + txt.big() + "</p>");
    document.write("<p>Small: " + txt.small() + "</p>");
    document.write("<p>Bold: " + txt.bold() + "</p>");
    document.write("<p>Italic: " + txt.italics() + "</p>");
    document.write("<p>Fixed: " + txt.fixed() + "</p>");
    document.write("<p>Strike: " + txt.strike() + "</p>");
    document.write("<p>Fontcolor: " + txt.fontcolor("green") + "</p>");
    document.write("<p>Fontsize: " + txt.fontsize(6) + "</p>");
    document.write("<p>Subscript: " + txt.sub() + "</p>");
    document.write("<p>Superscript: " + txt.sup() + "</p>");
    document.write("<p>Link: " + txt.link("https://www.w3schools.com") + "</p>");
    document.write("<p>Blink: " + txt.blink() + " (works only in Opera)</p>");
    
    尝试一下