Object.prototype
クラスに属性を追加する
構文
Object.prototype
例文
<html>
<head>
<title>Object.prototype</title>
</head>
<body>
<!--クラスに属性を追加するのサンプル-->
<script type="text/javascript">
String.prototype.stripTags = function(str) {
    return this.replace(/<\/?[^>]+>/gi, '');
}
var str = "<b>hogehoge</b>";
document.write(str.stripTags());
</script>
</body>
</html>
関連記事
スポンサーリンク







