javascript function called is undefined while parts of the page are loading

I have an aspx page that includes a javascript file in the head tag. This page has a user control placed on it. The user control has a link with an inline javascript function that references an object that is defined in the javascript file loaded on aspx page. The application consists of a master page and a number of other aspx pages. The page in question (with the javascript file) loads before any other page, and the link with the javascript file is rendered. However, if I click on the link, I get an error, saying "Microsoft JScript runtime error: 'Foo' is undefined". Where foo is an object defined in the javascript file. However, if I wait until all the parts of the page are loaded, the link works fine. What is happening here? How can I prevent this error from happening? Thanks.
Are you using an onload or $.ready function to do some DOM changes after everything is ready?

以上就是javascript function called is undefined while parts of the page are loading的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏