我有这个HTML:
<select onchange="check_status(this);" name="status[171]">
<option selected="true" value="open" data="04f2cf35e4d7a1c0158459fd0450a605">open</option>
<option value="in_process" data="04f2cf35e4d7a1c0158459fd0450a605">pending</option>
<option value="finished" data="04f2cf35e4d7a1c0158459fd0450a605">finished</option>
<option value="canceled" data="04f2cf35e4d7a1c0158459fd0450a605">canceled</option>
</select>
Run Code Online (Sandbox Code Playgroud)
和js
function check_status(obj){
var uid = obj.getAttribute('data');
alert(uid);
}
Run Code Online (Sandbox Code Playgroud)
但它始终警告null而不是数据值问题伙伴在哪里?谢谢
我有这个JS代码,我认为它等同于PHP str_word_count()函数,但它们仍然返回不同的单词计数.
我的JS代码:
//element f9 value is:
"Yes, for all people asking ? ? ? their selfs Have you ever dreamed to
visite World Travel Market 2015 ? we can confirm that now it is a great
time to go to London for World Travel Market 2015Yes, for all people
asking their selfs Have you ever dreamed to visite World Travel Market 2015 ?
we can confirm that now it is a great time to go to London for …Run Code Online (Sandbox Code Playgroud) 我已经准备好了这个jsfiddle,它说明了我的脚本如何计算每个所选选项属性价格总和的两倍.请帮我解决这个问题.
optionsamount是错的,我的意思是计算两次..为什么会这样?谢谢
function update_amounts(){
var sum = 0.0;
var optionsamount = 0.0;
$('#basketorder > tbody > .product').each(function() {
$('.selectedoptionselect option:selected').each(function(){
optprice = $(this).attr('price');
optionsamount+= parseFloat(optprice);
})
var qty = $(this).find('.qty option:selected').val();
var price = $(this).find('.price').val();
var amount = (qty*price);
sum+= (amount + optionsamount);
$(this).find('.amount').text(''+ amount.toFixed(2));
});
$('.total').text(sum);
}
Run Code Online (Sandbox Code Playgroud) 我有这个图像名称: very-nice-rose-123-3.jpg
如何将其切割成零件并仅接收最后一个破折号和图像扩展名之间的零件.我需要进入3这个例子.
我有这个数组:
array(3) {
["cod"]=> array(3) {
["code"]=> string(3) "cod"
["title"]=> string(38) "Pay on delivery"
["sort_order"]=> string(1) "1"
}
["pp_standard"]=> array(3) {
["code"]=> string(11) "pp_standard"
["title"]=> string(6) "PayPal"
["sort_order"]=> string(1) "1"
}
["bank_transfer"]=> array(3) {
["code"]=> string(13) "bank_transfer"
["title"]=> string(25) "bank_transfer"
["sort_order"]=> string(1) "2"
}
}
Run Code Online (Sandbox Code Playgroud)
我如何删除完整的数组
["cod"]=> array(3) {
["code"]=> string(3) "cod"
["title"]=> string(38) "Pay on delivery"
["sort_order"]=> string(1) "1"
}
Run Code Online (Sandbox Code Playgroud)
从上面的多维数组创建没有["cod"]数组的新多维数组?谢谢
我需要从下面的数组中获取" - "之间的每个字符串
array(2) {
[0]=> string(75) "2225-Fried chicks-PTB001-1-potato",
[1]=> string(72) "2226-Fried pig-PTB002-3-potato" }
Run Code Online (Sandbox Code Playgroud)
所以我可以把它炸成:
$id=2225;
$food=Fried chicks;
$barode= PTB001;
$qty=1;
$salad=potato;
Run Code Online (Sandbox Code Playgroud)
什么是紧张的方式?