简体   繁体   English

从onclick事件中调用javascript函数

[英]Calling javascript function from onclick event

Here is the javascript file http://www.zaarly.com/anywhere.js 这是JavaScript文件http://www.zaarly.com/anywhere.js

I'm calling Zaarly.Anywhere.open({title : 'iPad', description : 'An iPad', time : '6h', price : 200, mapCenter : 'San Francisco'}); 我叫Zaarly.Anywhere.open({title : 'iPad', description : 'An iPad', time : '6h', price : 200, mapCenter : 'San Francisco'}); from onclick event but it's giving this error in error console: 来自onclick事件,但在错误控制台中给出了此错误:

Zaarly.Anywhere is  undefined

The script is included successfully in header, I've checked that Any suggestions? 该脚本已成功包含在标题中,我检查了是否有任何建议? I'm new to javascript 我是javascript新手

I'm loading the javascript dynamically ie including it through javascript and it's loading correctly I've checked that 我正在动态加载javascript,即通过javascript包含它,并且加载正确,我已经检查过

Zaarly.Anywhere.open() is undefined Zaarly.Anywhere.open()未定义

According to that error message, Zaarly.Anywhere.open() does not have any properties. 根据该错误消息, Zaarly.Anywhere.open()没有任何属性。 In fact, it's undefined . 实际上,它是undefined

So, you have to look for Zaarly.Anywhere.open().xxxxx in your code, and remove/adjust .xxxxx , depending on the context. 因此,您必须在代码中寻找Zaarly.Anywhere.open().xxxxx ,然后根据上下文删除/调整.xxxxx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM