我有以下代码,我在许多页面上使用v类似的代码,但在这个特定的页面上,它只是在ie或ff中都不起作用
这是代码:
<form action='/productView.html' method=post name=prod_form>
<a href='javascript:;' onclick='document.forms['prod_form'].submit(); return false;' class='button101' style='margin-left:92px;'>".$button_text."</a>
<input type=hidden name=action value='".$button_text."'>
<input type=hidden name=PRid value=".$databack3[PRid].">
<INPUT type='hidden' name='cat_id' value=".$databack3[prodcatID].">
<INPUT type='hidden' name='for_user_id' value=".$for_user_id.">
<input type=hidden name=source value=".$source."></form>
Run Code Online (Sandbox Code Playgroud)
但是,如果我更改为正常按钮,如下所示它工作正常:
<form action='/productView.html' method=post name=prod_form>
<input type=submit name=action class=button99 value='".$button_text."' style='margin-left:85px;'
<input type=hidden name=PRid value=".$databack3[PRid].">
<INPUT type='hidden' name='cat_id' value=".$databack3[prodcatID].">
<INPUT type='hidden' name='for_user_id' value=".$for_user_id.">
<input type=hidden name=source value=".$source."></form>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我使用以下命令来激活js函数:
$(document).ready(function() {
$('.gl a').do_this({
Run Code Online (Sandbox Code Playgroud)
所以div类.gl中的任何链接都会激活do_this函数..简单
现在,我也想在另一个div链接上激活相同的功能,我可以这样做:
( $('.gl a') OR $('.gm a') ).do_this({
Run Code Online (Sandbox Code Playgroud)
试过所有的组合,但还没有工作,或者我只是需要复制其他类的整个事情?
我有两个表,项目和类别,下面的示例数据:
Items:
Title category_id
Item A 1
Item B 2
Item C 3
Item D 2
Item E 3
Item F 2
Categories
category_id category
1 wood
2 plastic
3 metal
Run Code Online (Sandbox Code Playgroud)
我需要做的是计算项目总数,然后列出每个类别中的数量以及总数的百分比
我知道我可以计算每个项目和总数,例如
select
count(*) as total,
sum(category_id=1) as cat_1,
sum(category_id=2
.... etc etc
Run Code Online (Sandbox Code Playgroud)
但有没有办法在不计算每一个的情况下完成所有操作(可能会添加新类别并希望保持工作)然后加入类别表以生成名称?
理想情况下,这是我想要返回的内容:
Category how many % of total
wood 1 17%
plastic 3 50%
metal 2 33%
Total 6 100%
Run Code Online (Sandbox Code Playgroud)
(17%是1/6 => 16.666666667%舍入).
我想显示按日期添加升序排序的表格的最后10行.
我知道我可以select count(*) as total from tableName,$offset = 10 - total然后select * from tableName order by dateadded asc limit 10 offset $offset
注意:我需要反向显示结果,顶部最旧,底部最新,因此简单地按desc排序不会产生我需要的东西
这可以在一个查询中完成吗?
我有一张桌子,每行有4个td单元格。它有一个隐藏的行,td colspan="4"里面有一个行。
当我显示隐藏的行时,它会忽略colspan="4"-是因为它首先被隐藏了吗?
有没有办法解决?
的HTML
<table>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr class="hidden" id="123">
<td colspan="4">full width</td>
</tr>
</table>
<a href="#" onclick="showRow(); return false;">click me</a>
Run Code Online (Sandbox Code Playgroud)
Java脚本
function showRow(){
el = document.getElementById('123');
el.style.display = 'block';
}
Run Code Online (Sandbox Code Playgroud)
的CSS
.hidden { display:none; }
Run Code Online (Sandbox Code Playgroud)
我正在尝试为 div onclick 的背景颜色设置动画,但它根本没有改变它:
超文本标记语言
<div id="list2" onclick="changeCol();">
color
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#list2{ width:200px; height:100px; border:1px solid #ccc; background-color:#ccc}
jQuery/JS
function changeCol(){
alert('foo'); // testing function called
$("#list2").animate({
backgroundColor: "#8bed7e"
}, 500).animate({
backgroundColor: "#ccc"
}, 500);
}
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?这是一个小提琴
我有以下函数,它接受数据集、字段名称和搜索字符串,然后使用 ES2015 的箭头函数来查找结果。
调用示例是:
var whatever = myDataSet.find(entry => entry.name === 'John');
Run Code Online (Sandbox Code Playgroud)
我需要从函数中的参数构建它,但无法获取字段名称。
功能:
findSingle: function(dataSet, fieldName, searchString){
return dataSet.find(entry => entry.fieldName === searchString);
}
Run Code Online (Sandbox Code Playgroud)
我会打电话给:
my.nameSpace.findSingle(dataSetName, 'name', 'John');
Run Code Online (Sandbox Code Playgroud)
我希望它随后调用:
dataSetName.find(entry => entry.name=== 'john');
Run Code Online (Sandbox Code Playgroud)
但它失败了。(如果我硬编码entry.name它按预期工作)我很确定这是因为我传递一个字符串作为对象属性,entry.name但我想不出另一种方法来做到这一点。
是否可以像这样将字符串传递到对象属性中,或者我应该以不同的方式进行操作?
我有一个JS对象数组:
var obj = [{key1: Value1, key2: VALUE2},{key1: Value1, key2: VALUE2}];
Run Code Online (Sandbox Code Playgroud)
我希望key2的值为小写,如下所示:
var obj = [{key1: Value1, key2: value2},{key1: Value1, key2: value2}];
Run Code Online (Sandbox Code Playgroud)
如何将值从小写更改为大写?
我有这个动画,我是这样设置的:
$colors: #360745, #D61C59, #E7D84B, #EFEAC5, #1B8798;
.text--line {
font-size: .5em;
color: transparent;
}
svg {
position: absolute;
width: 100%;
height: 100%;
background: hsl(200,70,11);
background-size: .12em 100%;
font: 16em/1 Arial;
z-index: 20000;
}
.text-last {
fill: white;
stroke: white;
opacity:0;
animation: fadeIn ease-in 1;
animation-duration:1s;
animation-delay:3s;
}
$max: 5;
$stroke-step: 7%;
.text-copy {
fill: none;
stroke: white;
stroke-dasharray: $stroke-step $stroke-step * ($max - 1);
stroke-width: 1px;
animation: stroke-offset 3s 1 linear;
@for $item from 1 through $max {
$stroke-color: nth($colors, …Run Code Online (Sandbox Code Playgroud) 我在让jquery对象呈现为html时遇到问题。
在下面的代码中,tickBoxgets呈现为,[object Object]而不是html,而其余所有都正确呈现。
我知道我可以将其添加为字符串,但这不是这里的目标。
为什么不将其tickBox呈现为html?
const legendData = ['hello world', 'welcome back', 'hotel california', 'never leave'];
const tickBox = $('<div/>', {
class: 'tickBox',
html: $('<div/>', {
class: 'ticked'
})
});
const legendContent = legendData.map(item => {
return $('<li/>', {
dataId: `${item.split(' ')[0]}`,
html: `${tickBox} ${item}`
/* I know I could do this */
//html: `<div class="tickBox"><div class="ticked"></div></div> ${item}`
});
});
$('<div/>', {
id: 'chartLegend',
class: 'legend',
title: 'Chart legend',
html: '<p id="chartLegendHeader">Legend</p>'
}).appendTo(`#chartContainer`);
$('<ul/>', …Run Code Online (Sandbox Code Playgroud)