我正在开发网站(使用 PHP、Mysql、jQuery 构建),它要求管理员在配置中设置一个变量,并根据该配置变量启用或禁用所有网站的 jQuery 自动完成功能。有什么方法可以实现该功能。
问问题
1117 次
2 回答
0
最简单的方法是为所有显示时间表的父元素添加一个通用 ID 或其他属性。然后在您的主 javascript 文件中包含以下形式的内容
FLAG = 1; //for visibile, or 0 for invisible
$('#calendar').toggle(FLAG); //OR
$('[rel=calendar]').toggle(FLAG);
如果您希望它来自 php,您可以随时在 php 中加载您的 javascript:
functions.js.php:
FLAG = <?php $CAL_SETTING ?>
//go on with the rest of the javascript
//then include it into your html
<script language="javascript" src="functions.js.php"></script>
祝你好运!
于 2011-09-13T19:20:24.827 回答
0
使用这些字段 [name, value,..] 创建一个表设置并设置名称 calendar_status 值 hide
在您看来,您可以从数据库中读取该字段并设置 myCalendar.hide(true); 或 myCalendar.hide(false);
myCalendar = new dhtmlXCalendarObject("DateStart");
myCalendar.hide(); <- you php code like <?php echo calendar_status; ?>
于 2013-03-14T10:39:40.077 回答