-1
任何人都可以在java腳本中展示下面的語法,因爲我是java腳本的新手我無法理解下面的代碼。任何人都可以解釋我在JavaScript中的下面的語法?
function validateAll(adMode, primaryAssetType, adCompanionAssetType) {
var check = adStickervalidationcheck(adMode, 'new', primaryAssetType, adCompanionAssetType);
if(check == true) {
check=calculateTotalnoofImpression('${campaignid}');
}
return check;
}
這裏在上面的代碼中爲什麼關鍵字new作爲參數傳遞而不使用任何對象。
下面是函數的定義代碼:
function adStickervalidationcheck(assetFormType,type,primaryAssetType,adCompanionAssetType)
{
if((trim(document.assetform.priority.value))=="select")
{
alert("Please select the priority.");
return false;
}
if((trim(document.assetform.impression.value).length)==0)
{
alert("Please enter Total Number of Impression.");
return false;
}
if((trim(document.assetform.impression.value))=="0")
{
alert("Total No. Of Impression should not be Zero(0).");
return false;
}
if(primaryAssetType=="Picture" || primaryAssetType=="Picture+Audio")
{
if((trim(document.assetform.picExt.value))=="select")
{
alert("Please select the extension of primary Image Asset File");
return false;
}
if(type!="edit")
{
if((trim(document.assetform.asset_import.value))=="")
{
alert("Please import the primary Image Asset File");
return false;
}
}
}
if(primaryAssetType=="Audio" || primaryAssetType=="Picture+Audio")
{
if((trim(document.assetform.audExt.value))=="select")
{
alert("Please select the extension of primary Audio Asset File");
return false;
}
if(type!="edit")
{
if((trim(document.assetform.asset_import_audio.value))=="")
{
alert("Please import the primary Audio Asset File");
return false;
}
}
}
if(adCompanionAssetType.contains("Picture") || adCompanionAssetType.contains("Video") || adCompanionAssetType.contains("Audio"))
{
if((trim(document.assetform.companion_assettype.value))=="select")
{
alert("Please select the extension of companion Asset File");
return false;
}
if(type!="edit")
{
if((trim(document.assetform.asset_import2.value))=="")
{
alert("Please import the companion Asset File");
return false;
}
}
}
if(adCompanionAssetType.contains("Audio") && adCompanionAssetType.contains("Picture"))
{
if((trim(document.assetform.companion_audio_Asset.value))=="select")
{
alert("Please select the extension of companion Audio Asset File");
return false;
}
if(type!="edit")
{
if((trim(document.assetform.asset_import4.value))=="")
{
alert("Please import the companion Media Asset File");
return false;
}
}
}
if(adCompanionAssetType.contains("Video") && adCompanionAssetType.contains("Picture"))
{
if((trim(document.assetform.companion_video_Asset.value))=="select")
{
alert("Please select the extension of companion Video Asset File");
return false;
}
if(type!="edit")
{
if((trim(document.assetform.asset_import4.value))=="")
{
alert("Please import the companion Media Asset File");
return false;
}
}
}
if(adCompanionAssetType.contains("URL"))
{
if((trim(document.assetform.UrlAssetfile.value).length)==0)
{
alert("Please enter the companion URL Asset File");
return false;
}
}
if(assetFormType=="Subscriber" || assetFormType=="User")
{
if((document.assetform.male.checked==false) && (document.assetform.female.checked==false))
{
alert("Please Choose Gender. ");
return false;
}
if((document.assetform.agegroup1.checked==false) &&
(document.assetform.agegroup2.checked==false)&&
(document.assetform.agegroup3.checked==false) &&
(document.assetform.agegroup4.checked==false))
{
alert("Please choose atleast one of the Age Group.");
return false;
}
if((document.assetform.professiongroup1.checked==false) &&
(document.assetform.professiongroup2.checked==false)&&
(document.assetform.professiongroup3.checked==false) &&
(document.assetform.professiongroup4.checked==false) &&
(document.assetform.professiongroup5.checked==false)&&
(document.assetform.professiongroup6.checked==false))
{
alert("Please choose atleast one of the Profession.");
return false;
}
if((trim(document.assetform.targetCity.value).length)==0)
{
alert("Please enter the targetCity");
return false;
}
if((trim(document.assetform.targetArea.value).length)==0)
{
alert("Please enter the targetArea");
return false;
}
if((trim(document.assetform.targetPincode.value).length)==0)
{
alert("Please enter the targetPinCode");
return false;
}
}
return true;
}
我不認爲'新'是一個關鍵詞,因爲它被**引用**,它的一個字符串! –
沒有看到'adStickervalidationcheck'函數沒有人可以告訴你。提供'adStickervalidationcheck'功能代碼。 – atinder
你發現哪些代碼片段特別不清楚?你不懂什麼語法? –