我这样做是为了加载图像并在对话框中显示图像.
<div id="image_preview" title="Client Photo Preview">
<p><img src="" alt="client image" id="client_image_preview" /></p>
</div>
$("#client_image_preview").attr("src", imagelocation);
$('#image_preview').dialog({
height: 'auto',
width: 'auto',
modal: true,
dialogClass: 'titleless',
buttons: { "CLOSE": function() { $(this).dialog("destroy"); } }
});
Run Code Online (Sandbox Code Playgroud)
是否有方法显示加载gif图像加载jquery?
问候
我想计算今天和给定日期之间的天数,并检查截至今天剩余的天数或今天过去的天数.
var today = new Date();
var date_to_reply = new Date('2012-10-15');
var timeinmilisec = today.getTime() - date_to_reply.getTime();
console.log( Math.floor(timeinmilisec / (1000 * 60 * 60 * 24)) );
Run Code Online (Sandbox Code Playgroud)
这给了我5个答案,但是我应该如何得到(-5),因为date_to_reply是从今天起的5天过去了?
这是计算任何给定日期的正确方法吗?
问候
可能重复:
在PHP中,如何更改数组元素的键?
这个数组
Array
(
[0] => Array
(
[id] => 1
[due_date] => 2011-09-23
[due_amount] => 10600.00
)
[1] => Array
(
[id] => 2
[due_date] => 2011-10-23
[due_amount] => 10600.00
)
[2] => Array
(
[id] => 3
[due_date] => 2011-11-23
[due_amount] => 10600.00
)
)
Run Code Online (Sandbox Code Playgroud)
如何在这个数组中将id更改为u_id?
问候
如何编写与活动记录类似的选择查询?
SELECT * FROM test_tbl WHERE date BETWEEN '$start' and '$end' ORDER BY ID
Run Code Online (Sandbox Code Playgroud)
问候
知道如何突出显示新插入的行吗?
我尝试使用商店的添加事件,它给了我最后插入的记录和记录索引。
但是我如何引用它来突出显示网格行?
这是商店。
Ext.create('Ext.data.Store', {
model : 'invoice_model',
storeId : 'invoice_store',
proxy : {
type: 'memory'
},
listeners : {
add : function(s, r, i){
console.log(r)
}
}
});
Run Code Online (Sandbox Code Playgroud)
问候
我已配置extjs store来加载来自useragentstring.com api的数据,这个api返回这样的数据
{"agent_type":"Browser","agent_name":"Opera","agent_version":"9.70","os_type":"Linux","os_name":"Linux","os_versionName":"","os_versionNumber":"","os_producer":"","os_producerURL":"","linux_distibution":"Null","agent_language":"English - United States","agent_languageTag":"en-us"}
Ext.define('Oms.model.Userinfo', {
extend : 'Ext.data.Model',
fields : ['agent_type', 'agent_name', 'agent_version', 'os_type', 'os_name']
});
Ext.define('Oms.store.Userinfo', {
extend : 'Ext.data.Store',
model : 'Oms.model.Userinfo',
proxy: {
type : 'jsonp',
reader : {
type: 'json',
root: ''
}
}
});
Run Code Online (Sandbox Code Playgroud)
这个商店抛出一个错误

也许这是因为这个json中没有root?
任何想法如何正确读取此输出和加载存储?
问候
我有两个像这样的阵列
第一个数组
Array
(
[0228] => Array
(
[name] => ''
[address] => ''
)
[0275] => Array
(
[name] => ''
[address] => ''
)
)
Run Code Online (Sandbox Code Playgroud)
第二阵列
Array
(
[0228] => Array
(
[start_date] => ''
[payment] => ''
)
[0275] => Array
(
[start_date] => ''
[payment] => ''
)
)
Run Code Online (Sandbox Code Playgroud)
我想通过匹配数组键来组合这两个,并得出像
Array
(
[0228] => Array
(
[name] => ''
[address] => ''
[start_date] => ''
[payment] => ''
)
[0275] => Array
(
[name] => '' …Run Code Online (Sandbox Code Playgroud) 我想在ExtJS树面板中构建一个Json输出列表文件夹结构.该结构应该相当于Json中的这个数组:
Array
(
[text] => .
[children] => Array
(
[0] => Array
(
[text] => files
[children] =>
)
[1] => Array
(
[text] => folder 1
[children] =>
)
[2] => Array
(
[text] => New directory
[children] => array(
[0] => Array
(
[text] => sub_1
[children] => array(
[0] => Array
(
[text] => sub_1_1
[children] =>
)
[1] => Array
(
[text] => sub_1_2
[children] =>
)
)
)
[1] => Array
(
[text] => …Run Code Online (Sandbox Code Playgroud) 这是我的上传功能
public function do_upload()
{
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'gif|jpg|png';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('customer_photo'))
{
$responce->success = false;
$responce->data['error'] = $this->upload->display_errors();
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->_do_resize($data);
}
echo json_encode($responce);
}
Run Code Online (Sandbox Code Playgroud)
这是我在firebug控制台上看到的json
{"success":false,"data":{"error":"<p>The filetype you are attempting to upload is not allowed.<\/p>"}}</p>
Run Code Online (Sandbox Code Playgroud)
任何想法为什么它包含</p>和这些<\/p>?
问候
有两列设置喜欢这个
.left_inside_tab{ float: left; padding-left: 25px; width: 45%; }
.right_inside_tab{ float: right; width: 45%;}
Run Code Online (Sandbox Code Playgroud)
我试着像这样得到宽度
console.log ($('.left_inside_tab').width());
console.log ($('div.left_inside_tab').width());
Run Code Online (Sandbox Code Playgroud)
两者都给了
结果是45.问题是45不是以像素为单位的百分比
我做错了什么?
问候
我试着用codeigniter编写一个更新密码的函数,这里是代码
public function changepass(){
$password = md5( $this->_clean($_POST['Password']) );
$data = array(
'Password' => $password
);
$this->db->update('users', $data, array('UserName' => $_POST[UserName]));
}
Run Code Online (Sandbox Code Playgroud)
这会更新数据库但仍会抛出一条消息
Severity: Notice
Message: Use of undefined constant UserName - assumed 'UserName'
Run Code Online (Sandbox Code Playgroud)
如何防止此消息以及如何检查查询是否成功执行并在这种情况下回显消息"成功"?
我有这样的阵列
["5763.34", "5500.00", "5541.67", "5541.67"]
Run Code Online (Sandbox Code Playgroud)
我想计算类似的价值并得到一个像
(1 * 5763.34) + (1 * 5500.00) + (2 * 5541.67)
Run Code Online (Sandbox Code Playgroud)
知道如何做到这一点?
我试图像这样生成当月的日子
$year = date('Y');
$month = date('m');
$dayCount = cal_days_in_month(CAL_GREGORIAN,$month,$year);
for ($i = 1; $i <= $dayCount; $i++)
{
$tree_data->data[$i] = $year."-".$month."-".$i;
}
print "<pre>";
print_r($tree_data);
Run Code Online (Sandbox Code Playgroud)
这让我输出像
stdClass Object
(
[data] => Array
(
[1] => 2011-12-1
[2] => 2011-12-2
[3] => 2011-12-3
[4] => 2011-12-4
[5] => 2011-12-5
[6] => 2011-12-6
[7] => 2011-12-7
[8] => 2011-12-8
[9] => 2011-12-9
[10] => 2011-12-10
[11] => 2011-12-11
[12] => 2011-12-12
[13] => 2011-12-13
[14] => 2011-12-14
[15] => 2011-12-15
[16] …Run Code Online (Sandbox Code Playgroud)