2013-02-07 82 views
0

可變CIMtrek_Attachement_1越來越不確定它不檢查,如果條件將其移動到該行var selecteditems = CIMtrek_Attachement_1.split("\\");JavaScript的數據越來越不確定

var CIMtrek_Attachement_1= $("#CIMtrek_RegWhseCo_Attachement_1").val(); 

      alert("CIMtrek_Attachement_1=666666==>> "+CIMtrek_Attachement_1); 
      if (CIMtrek_Attachement_1 !== null && CIMtrek_Attachement_1 !== "" && CIMtrek_Attachement_1 === undefined) 
      { 
       var selecteditems = CIMtrek_Attachement_1.split("\\"); 

       var filename = selecteditems[(selecteditems.length-1)]; 

       alert("selecteditems=666==>> "+selecteditems); 
       alert("filename=66666==>> "+filename); 

       nodeField = createNodeField(xmlDoc, new Array("FieldName"), "Record") 
       nodeField.attributes[0].value = NewFormFields[i] 

       nodeField.appendChild(xmlDoc.createTextNode(filename)); 

       rootElement.appendChild(nodeField); 
      } 
+0

div中id =「CIMtrek_RegWhseCo_Attachement_1」存在於html中嗎? –

+0

所以,你沒有得到警報的價值呢? –

回答

0

嘗試typeof(CIMtrek_Attachement_1) === undefined :),而不是它應該是!==,而不是===?

+0

不等於未定義,空字符串到該特定字段 – user1619558

+0

只是因爲你有:不空,等於undefined而不等於undefined – Chris

+0

是感謝您的指導 – user1619558