对象的方法的引用-JavaScript教程--从入门到精通

时间:2021-04-25 08:58:43
【文件属性】:
文件名称:对象的方法的引用-JavaScript教程--从入门到精通
文件大小:254KB
文件格式:PPT
更新时间:2021-04-25 08:58:43
JS教程 对象的方法的引用 在JavaScript中对象方法的引用是非常简单的。 ObjectName.methods() 实际上methods()=FunctionName方法实质上是一个函数。 如引用university对象中的showmy()方法,则可使用: document.write (university.showmy()) 或:document.write(university) 如引用math内部对象中cos()的方法 则: with(math) document.write(cos(35)); document.write(cos(80)); 若不使用with则引用时相对要复杂些: document.write(Math.cos(35)) document.write(math.sin(80))

网友评论