在Javascript中使用警报时出错(对象的属性'alert'不是函数) [英] Error on using alert in Javascript (Property 'alert' of object is not a function)

查看:101
本文介绍了在Javascript中使用警报时出错(对象的属性'alert'不是函数)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是尝试使用alert并在警报中放入一个字符串变量并收到错误:

I am just trying to use alert and put a string variable inside the alert and get an error:

Uncaught TypeError: Property 'alert' of object [Object Window] is not a function

我的代码是:

var shortenurl = msg.d;
alert(shortenurl);

我检查过该值,并且里面有一个字符串,而不是一个对象。

I've checked the value and it has a string inside, not an object.

推荐答案

由于我的弹出窗口阻止 alert(),我收到了错误消息up-blocker。

I had that error message due to an alert() blocked by my pop-up-blocker.

这篇关于在Javascript中使用警报时出错(对象的属性'alert'不是函数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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