Prototype - dasherize() 方法
此方法将下划线字符("_")的每个实例替换为破折号("-")。
语法
string.dasherize();
返回值
返回一个字符串。
示例
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function showResult() { var str = 'border_bottom_width'; alert("border_bottom_width.dasherize():"+str.dasherize()); } </script> </head> <body> <p>单击按钮查看结果。</p> <br /> <br /> <input type = "button" value = "Result" onclick = "showResult();"/> </body> </html>
输出
prototype_string_processing.html