当我们实现母版页时,JavaScript 会产生问题吗
当我们实现母版页时,JavaScript 会产生问题吗?
在我看来,在使用母版页的应用程序上维护和实现 JavaScript 是相当困难的。有什么捷径或者相反吗?
Does JavaScript create an issue when we implement master pages?
It seems to me that it is quite tough to maintain and implement JavaScript on an application where we have used master pages. Is there any shortcut or the other way round to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Hai HotTester,
主要问题是查找应用程序中使用的控件的ClientId。
Hai HotTester,
The Major issue would be finding ClientId's of controls used in your application.
在 ASP.NET 中使用母版页时不会出现 JavaScript 问题,除非您创建了一些母版页。 ;)
在编写 javascript 时,您应该看到处理页面时生成的最终 html,并处理该 html,而不是考虑母版页或内容页。您可以将常用的 javascript 函数放在母版页中,以便在所有内容页中都可以访问它。另外,我建议将所有 javascript 放入外部文件中,并将其包含在母版页中。这是一个很好的做法。
如果您遇到一些问题,您可以发布具体问题,我们可以尝试解决它们。
一切顺利...
There are no javascript issues when using master pages in asp.net unless you create some. ;)
While writing javascript you should see the final html generated when the page is processed and work on that html rather than thinking in terms of master page or content pages. You can put your common javascript functions in the master page so that it can be accessed in all the content pages. Also I would recommend putting all your javascript in an external file and including it in the master page. This is a good practice.
If you are facing some issues you can post the specific problem and we can try and solve them.
All the best...
在 ASP.Net 3.5 的 MasterPages 中查找 ClientID 没有问题...因为内容页面有自己的 head 标签,与 ASP.Net 2.0 不同
There is no issue with finding of ClientID's in MasterPages in ASP.Net 3.5... As the content page has its own head tag unlike ASP.Net 2.0