从onclick事件调用javascript函数 [英] Calling javascript function from onclick event

查看:134
本文介绍了从onclick事件调用javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是JavaScript文件 http://www.zaarly.com/anywhere.js



我打电话给 Zaarly.Anywhere.open({title:'iPad',description:'iPad',time:'6h' ,价格:200,mapCenter:'旧金山'}); 来自onclick事件,但它在错误控制台中给出了这个错误:

  Zaarly.Anywhere未定义

脚本已成功包含在标题中,I已经检查过
有什么建议吗?我是新来的JavaScript



我正在动态加载JavaScript,包括它通过JavaScript,它正确加载我检查了



Zaarly.Anywhere.open()未定义


根据该错误消息, Zaarly.Anywhere.open()没有任何属性。事实上,它是 undefined



因此,您必须查找 Zaarly.Anywhere .open()。xxxxx ,并根据上下文移除/调整 .xxxxx


Here is the javascript file http://www.zaarly.com/anywhere.js

I'm calling 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:

Zaarly.Anywhere is  undefined

The script is included successfully in header, I've checked that Any suggestions? I'm new to javascript

I'm loading the javascript dynamically i.e. including it through javascript and it's loading correctly I've checked that

解决方案

Zaarly.Anywhere.open() is undefined

According to that error message, Zaarly.Anywhere.open() does not have any properties. In fact, it's undefined.

So, you have to look for Zaarly.Anywhere.open().xxxxx in your code, and remove/adjust .xxxxx, depending on the context.

这篇关于从onclick事件调用javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆