简体   繁体   English

IIS7.5上的网站内部的Javascript无法运行-Windows Server 2008 R2

[英]Javascript not working inside a website on IIS7.5 - Windows Server 2008 R2

I have deployed a website in IIS 7.5 on windows server 2008 R2. 我已经在Windows Server 2008 R2的IIS 7.5中部署了一个网站。 The javascript runs fine when i run the application from my local machine , but when deployed on IIS 7.5 , it fails to run the javascript part of my menu . 当我从本地计算机上运行应用程序时,javascript运行正常,但是在IIS 7.5上部署时,它无法运行菜单的javascript部分。 please help me solve this problem. 请帮助我解决这个问题。

onclick="ShowSubMenuUser(); 的onclick =“ShowSubMenuUser();

Above is the code which doesn't fires when i click on my menu item . 上面的代码在我单击菜单项时不会触发。 The function contains the following code : 该函数包含以下代码:

function ShowSubMenuUser()
{
    document.getElementById("ctl00_trsubViewUser").style.display = "block";
    document.getElementById("ctl00_trsubRegisterUser").style.display = "block";
    document.getElementById("ctl00_trSubMenuItemFooterUser").style.display = "block";
    document.getElementById("ctl00_trPOReport").style.display = "block";
}

This code runs fine on Local Machine as well as in Visual Studio , but on Server when i click on the menu , nothing happens . 这段代码可以在本地计算机和Visual Studio上正常运行,但是在服务器上,当我单击菜单时,没有任何反应。

The problem is your user control name. 问题是您的用户控件名称。

ctl00_trsubViewUser ctl00_trsubViewUser

The CT100_ may have a different name on localhost and on the server. CT100_在本地主机和服务器上的名称可能不同。

Change the user control dropped on the parent page to have ClientIDMode="Static" then the control name will not change. 将放置在父页面上的用户控件更改为具有ClientIDMode =“ Static”,则控件名称将不会更改。

View your source when rendering the page on the server and without client id mode you should see the name of the control is not the same as on localhost. 在服务器上呈现页面时,如果没有客户端ID模式,请查看源代码,您应该看到控件的名称与localhost上的名称不同。

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

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