0
我想從javascript函數調用窗體和php文件,但它不起作用。這可能與餅乾做的,它不叫「frmSubdeptChainDailyHL」的形式,它不叫「subdeptclass_reportHL.php」文件,這裏是代碼:PHP文件沒有從javascript函數調用
function submitClassChainDaily()
{
var store = readCookie('storeAccess');
var clss = readCookie('classAccess');
var subdept = readCookie('subDeptAccess');
var period = readCookie('period');
if (period == null || period == '') {
period = 'CUR';
}
document.frmClassChainDaily.period.value = period;
var storePref = readCookie('storePref');
if (storePref == null || storePref == '') {
if (store == null || store == '') {
storePref = 'ALL';
} else {
storePref = store;
}
}
if ((storePref.length) > 3 && storePref != 'ALL100') {
document.setStore.submit();
} else {
document.frmClassChainDaily.store.value = storePref;
if (clss == null || clss == '') {
clss = 'ALL';
}
document.frmClassChainDaily.clss.value = clss;
if (subdept == null || subdept == '') {
subdept = 'ALL';
}
document.frmClassChainDaily.subdept.value = subdept;
";
if ($_REQUEST['storePref']=='099')
{
echo "document.frmSubdeptChainDailyHL.submit();";
} else {
echo "document.frmSubdeptChainDaily.submit();";
}
echo "
}
}
Here is the form code:
if ($_REQUEST['storeCode'] == '099') {
echo"
<li>
<!-- SubDept Daily Sales - Chain -->
<form name=\"frmSubdeptChainDailyHL\" action=\"subdeptclass_reportHL.php\">
<input type=hidden value=\"\" name=\"store\">
<input type=hidden value=\"\" name=\"subdept\">
<input type=hidden value=\"\" name=\"clss\">
<input type=hidden value=\"\" name=\"period\">
</form>
<a style=\"display: block; text-decoration: none; color: #000\" href=\"javascript: submitSubDeptChainDaily();\">
<h3 class=\"longfield\">
<img src=\"content/images/icons/US_dollar_icon.png\" alt=\"icon\" class=\"icon\"/>
<span>Sales</span>
</h3>
</a>
</li>
什麼是setstore? – mplungjan
一個是'storePref',另一個是'storeCode'。那是對的嗎? –
哦,是的,對不起,他們都是storePref,我忘了更換第二個。 – user1941350