我有一个自定义的x可编辑输入类型,用于输入城市并选择一个像这样渲染的国家:
注意底部的按钮; 这是因为初始化代码包含showbuttons: 'bottom'
:
$('#location').editable({
url: '/post',
title: 'Enter city and country',
showbuttons: 'bottom',
value: {
city: "Napier",
country: "nz"
},
sourceCountry: [
{value: "af", text: "Afghanistan"},
...
{value: "zw", text: "Zimbabwe"}
]
});
Run Code Online (Sandbox Code Playgroud)
但对于这个小部件,在侧面渲染按钮是没有意义的; 所以我希望按钮默认存在; 因此,我尝试为此可编辑类型设置默认值:
Location.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
tpl: '' +
'<div class="editable-location">' +
'<label><span>City: </span><input type="text" name="city"></label>' +
'</div>' +
'<div class="editable-location">' +
'<label><span>Country: </span><select name="country"></select></label>' +
'</div>',
inputclass: '',
showbuttons: 'bottom',
sourceCountry: []
});
Run Code Online (Sandbox Code Playgroud)
但showbuttons
关键是被忽视; 其他人正在申请罚款,但不是这个.那么如何设置可编辑类型的默认值?
这是可编辑的代码,
(function ($) { …
Run Code Online (Sandbox Code Playgroud) 是否可以为数组的每个元素指定一个名称?例如,在数组中myArr[5]
,我可以myArr[0]
将名称命名为"First",myArr[1]
"Second"等等吗?如果没有,那么实现类似结果的可行方法是什么?
else {
if ($_COOKIE['HotspotLanguage'] == 'ENG') {
$url_lang_code = '?lang=eng';
header('Location: '.$url_captive_portal.$url_lang_code.'');
} elseif ($_COOKIE['HotspotLanguage'] == 'ALB') {
$url_lang_code = '?lang=alb';
header('Location: '.$url_captive_portal.$url_lang_code.'');
} elseif ($_COOKIE['HotspotLanguage'] == 'MKD') {
$url_lang_code = '?lang=mkd';
header('Location: '.$url_captive_portal.$url_lang_code.'');
}
}
Run Code Online (Sandbox Code Playgroud)
从上面的代码中可以看出,我已经定义了一个变量$url_lang_code
; 但是,我的变量在if
声明之外不起作用.
URL被重写,这是有效的.但是,如果我使用$url_lang_code
if语句之外的某个地方,它就不起作用......
难道我做错了什么?