Javascript Boolean.toSource()方法
作者:--
发布时间:2019-11-20
评论:0
阅读:1
javascript boolean.tosource()方法返回表示对象的源代码的字符串。
注意:此方法不会在internet explorer中运行。
语法
boolean.tosource()
下面是参数的详细信息:
返回值
返回表示对象的源代码的字符串。
例子:
<html>
<head>
<title>javascript tosource() method</title>
</head>
<body>
<script type="text/javascript">
function book(title, publisher, price)
{
this.title = title;
this.publisher = publisher;
this.price = price;
}
var newbook = new book("perl","leo inc",200);
document.write(newbook.tosource());
</script>
</body>
</html>
这将产生以下结果:
({title:"perl", publisher:"leo inc", price:200})