我只是阅读经典的K&R并遇到以下语法:
printf("%.*s",max,s);
Run Code Online (Sandbox Code Playgroud)
"."这里的含义是什么?当我不在"."这里应用时,则会打印整个字符串,但是当我们不应用a时".",将打印最多的最大字符.如果有人能够解释这一点,我将非常感激.
我有这样的html文档:
<div id="obselect">
<div id="objects">
<span id="j_id0:j_id2:userPanel">
<table>
<tbody><tr>
<th class="subheading" width="40%">Available Objects</th>
<th class="subheading" width="20%"> </th>
<th class="subheading" width="40%">Selected Objects</th>
</tr>
<tr>
<td><span id="j_id0:j_id2:snondrag">
<select name="j_id0:j_id2:j_id18" multiple="multiple" size="5"> <option value="001">Account</option>
<option value="002">Note</option>
<option value="a0j">Text Ad</option>
</select>
</span></td>
</tr>
</tbody>
</table>
</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我需要在select标签上应用 css。但我找不到办法做到这一点。在我的服务器上,该文档是动态生成的,因此我无法控制它使用哪些标签。唯一的硬编码div是最外面的 div : <div id="obselect">。有没有办法通过使用类似以下内容来将样式应用于select其中的所有标签:div
#obselect > select
{
// CSS
}
Run Code Online (Sandbox Code Playgroud) 谷歌浏览器,Firefox和其他浏览器都有一个显示错误的开发者控制台.这些是由相同的错误引发的window.onerror吗?
在chrome中我试图检查日期是否是有效日期.
有一个变量:
var d = new Date('9/'); // Not a correct format
Run Code Online (Sandbox Code Playgroud)
在Chrome中
console.log(new Date('9/')); // Output: Sat Sep 01 2001 00:00:00 GMT+0530 (India Standard Time) Which is wrong as I am providing wrong date.
Run Code Online (Sandbox Code Playgroud)
在Firefox中
console.log(new Date('9/')); // Output: Invalid Date
Run Code Online (Sandbox Code Playgroud)
还使用firefox中的date.toLocaleString()输出06 May 2007 00:00:00
在铬中它是1/9/2001;
所以我的问题是如何在chrome中验证日期并保持代码不受这些差异的影响.如果需要更多细节请写评论.