なぜこの単純な関数が私が望むように機能しないのか理解できません:)
c = document.form.product_catid.selectedIndex;
if (document.form.product_name.value == "" && document.form.product_catid[c].value == "")
{
alert ("Please, define at least product name or product category !");
return false;
}
else if (!(document.form.product_name.value == ""))
{
return true;
}
else if (!(document.form.product_catid[c].value == ""))
{
return true;
}
else
{
alert ("Please, dont define two of them at the same time!");
return false;
}
return true;
私が欲しいのは、product_nameという名前の入力が入力されたとき、またはproduct_catidという名前のselectが選択されたときだけです。関数はtrueを返しますが、それらのいずれも定義されていない場合、または両方が定義されていない場合は、2つの異なるアラートをアラートさせたいです)助けてくれてありがとう、 ほんとうにありがとう!