2014-01-23 51 views
-1

我正在開發一個Web應用程序。在那裏,我使用了一個Javascript文件進行驗證。 它工作正常,但現在我在JavaScript文件中做了一些更改。 我只收到舊的警報消息。 但是在那個Javascript文件中,我沒有警告消息。 這是我的老js和新的js。JavaScript文件未在ASP.net網站中更新

新的JavaScript:

function ValidateSkill() { 
    var skill1 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet1'); 
    var skillrate1 = document.getElementById('ctl00_ContentPlaceHolder1_ddlselfrating'); 
    var skill2 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet2'); 
    var skillrate2 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating1'); 
    var skill3 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet3'); 
    var skillrate3 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating2'); 
    var skill4 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet4'); 
    var skillrate4 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating3'); 
    var skill5 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet5'); 
    var skillrate5 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating4'); 
    var skill6 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet6'); 
    var skillrate6 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating5'); 

    var count = 0; 


    if (skill1.value != "") { 
     count++; 
     if (skillrate1.selectedIndex == 0) { 

      alert('Please enter the Self rating'); 
      skillrate1.focus(); 
      return false; 
     } 
    } 



    if (skill2.value != "") { 
     count++; 
     if (skillrate2.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate2.focus(); 
      return false; 
     } 
    } 



    if (skill3.value != "") { 
     count++; 
     if (skillrate3.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate3.focus(); 
      return false; 
     } 
    } 



    if (skill4.value != "") { 
     count++; 
     if (skillrate4.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate4.focus(); 
      return false; 
     } 
    } 



    if (skill5.value != "") { 
     count++; 
     if (skillrate5.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate5.focus(); 
      return false; 
     } 
    } 


    if (skill6.value != "") { 
     count++; 
     if (skillrate6.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate6.focus(); 
      return false; 
     } 
    } 

    if (count == 0) { 
     alert('Please enter atleast one Skill Set'); 
     skill1.focus(); 
     return false; 
    } 


    return ValidateUnqiue(); 

} 
function ValidateUnqiue() { 

    var skill1 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet1'); 
    var skill2 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet2'); 
    var skill3 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet3'); 
    var skill4 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet4'); 
    var skill5 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet5'); 
    var skill6 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet6'); 
    var count = 0; 

    if (skill1.value != "") { 
     count++; 

    } 
    if (skill2.value != "") { 
     count++; 
    } 
    if (skill3.value != "") { 
     count++; 
    } 
    if (skill4.value != "") { 
     count++; 
    } 
    if (skill5.value != "") { 
     count++; 
    } 
    if (skill6.value != "") { 
     count++; 
    } 

    if (count == 0) { 
     alert('enter altleast one skill set'); 
     return false; 
    } 

    var skillarr = new Array(); 
    skillarr[skillarr.length] = skill1.value; 
    skillarr[skillarr.length] = skill2.value; 
    skillarr[skillarr.length] = skill3.value; 
    skillarr[skillarr.length] = skill4.value; 
    skillarr[skillarr.length] = skill5.value; 
    skillarr[skillarr.length] = skill6.value; 

    for (var i = 0; i < skillarr.length; i++) { 

     for (var j = i + 1; j < skillarr.length; j++) { 


      if (skillarr[i] != "" && skillarr[j] != "") { 


       if (skillarr[i] == skillarr[j]) { 
        alert("Don't enter the same skill"); 
        return false; 

       } 
      } 
     } 

    } 
    return true; 

} 

舊的JavaScript

function Validate() { 
    var skill1 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet1'); 
    var skillrate1 = document.getElementById('ctl00_ContentPlaceHolder1_ddlselfrating'); 
    var skill2 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet2'); 
    var skillrate2 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating1'); 
    var skill3 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet3'); 
    var skillrate3 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating2'); 
    var skill4 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet4'); 
    var skillrate4 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating3'); 
    var skill5 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet5'); 
    var skillrate5 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating4'); 
    var skill6 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet6'); 
    var skillrate6 = document.getElementById('ctl00_ContentPlaceHolder1_ddlSelfrating5'); 

    var count = 0; 


    if (skill1.value != "") { 
     count++; 
     if (skillrate1.selectedIndex == 0) { 

      alert('Please enter the Self rating'); 
      skillrate1.focus(); 
      return false; 
     } 
    } 



    if (skill2.value != "") { 
     count++; 
     if (skillrate2.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate2.focus(); 
      return false; 
     } 
    } 



    if (skill3.value != "") { 
     count++; 
     if (skillrate3.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate3.focus(); 
      return false; 
     } 
    } 



    if (skill4.value != "") { 
     count++; 
     if (skillrate4.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate4.focus(); 
      return false; 
     } 
    } 



    if (skill5.value != "") { 
     count++; 
     if (skillrate5.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate5.focus(); 
      return false; 
     } 
    } 


    if (skill6.value != "") { 
     count++; 
     if (skillrate6.selectedIndex == 0) { 
      alert('Please enter the Self rating'); 
      skillrate6.focus(); 
      return false; 
     } 
    } 

    if (count == 0) { 
     alert('Please enter atleast one Skill Set'); 
     skill1.focus(); 
     return false; 
    } 


    return ValidateUnqiue(); 

} 
function ValidateUnqiue() { 

    var skill1 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet1'); 
    var skill2 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet2'); 
    var skill3 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet3'); 
    var skill4 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet4'); 
    var skill5 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet5'); 
    var skill6 = document.getElementById('ctl00_ContentPlaceHolder1_txtbxSkillSet6'); 

    if (skill1.value == skill2.value || skill1.value == skill3.value || skill1.value == skill4.value || skill1.value == skill5.value || skill1.value == skill6.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    if (skill2.value == skill1.value || skill2.value == skill3.value || skill2.value == skill4.value || skill2.value == skill5.value || skill2.value == skill6.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    if (skill3.value == skill1.value || skill3.value == skill2.value || skill3.value == skill4.value || skill3.value == skill5.value || skill3.value == skill6.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    if (skill4.value == skill1.value || skill4.value == skill3.value || skill4.value == skill2.value || skill4.value == skill5.value || skill4.value == skill6.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    if (skill5.value == skill1.value || skill5.value == skill3.value || skill5.value == skill4.value || skill5.value == skill2.value || skill5.value == skill6.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    if (skill6.value == skill1.value || skill6.value == skill3.value || skill6.value == skill4.value || skill6.value == skill5.value || skill6.value == skill2.value) { 
     alert('Do not enter the same skill set more than once'); 
     return false; 
    } 
    return true; 

} 
+0

你構建解決方案和網站? – MusicLovingIndianGirl

+0

是的,我構建解決方案 –

+0

發佈您的代碼。 – MusicLovingIndianGirl

回答

0

Javascript文件緩存像其他的文件,所以有可能是您的瀏覽器緩存,代理緩存等。更改的名稱你的JS文件可能是最簡單的解決方案,讓每個人都能更新它。如果在您的Web應用程序中引用了文件myjslibrary.js,請參閱myjslibrary2.js並重命名該文件。

,不過也許它只是一個本地緩存問題(瀏覽器),只是試圖強行清除瀏覽器緩存:http://www.refreshyourcache.com/en/cache/

+0

是的我已經嘗試重命名js文件和js文件中的方法。然後我刪除舊的sln文件,然後打開我的網站並構建它。並且我還將我的項目放在另一個系統上並構建它。我得到了同樣的警報 –

+0

@ShankarG你試過另一個(乾淨的)瀏覽器嗎?還要確保有一些修改(只是爲了更新文件的修改日期)到郵件html。 (如果索引未修改,某些瀏覽器不會更新其他內容) – FrancescoMM

+0

是的,我也嘗試過不同的瀏覽器。 –