我正在尝试显示一个警告框onpageload,它调用以前定义的函数。但是,它没有正确显示,因为字面上显示了对象属性mycircle.retArea和mycircle.retCirc。
<body onload="window.alert('The area of the circle is: + mycircle.retArea()\nThe circumference of the circle is: + mycircle.retCirc()');">
我猜我的报价有问题吗?
谢谢!
答案 0 :(得分:0)
尝试
<body onload="window.alert('The area of the circle is:' + mycircle.retArea() + '\nThe circumference of the circle is:' + mycircle.retCirc());">