- 0133技术站
- 联系QQ:18840023
- QQ交流群
- 微信公众号
Javascript boolean toSource() 方法返回一个表示对象源代码的字符串。
注意:boolean toSource()方法与所有浏览器不兼容。
语法:
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() is : "+ newBook.toSource()); </script> </body> </html>
成功执行上述代码后,将显示以下输出:
({title:"Perl", publisher:"Leo Inc", price:200})
推荐手册