我创建了这个脚本,用正确的类打开一个div并关闭其他的.
function showhide(id) {
if (document.getElementById) {
var divid = document.getElementById(id);
var divs = document.getElementsByClassName("hideable");
for (var i = 0; i < divs.length; i = i + 1) {
divs[i].style.display = "none";
}
divid.style.display = "block";
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
是否可以制作一些动画,如fadout,easyout而不是仅通过显示选项显示它?
我在stackoverflow中找到了这个脚本.
function showhide(id){
if (document.getElementById) {
var divid = document.getElementById(id);
var divs = document.getElementsByClassName("hideable");
for(var div in divs) {
div.style.display = "none";
}
divid.style.display = "block";
}
return false;
}
<a href="#" onclick="showhide('features');" >features</a>
<a href="#" onclick="showhide('design');" >design</a>
<a href="#" onclick="showhide('create');" >create</a>
<div class="hideable" id="features">Div 1</div>
<div class="hideable" id="design">Div 2</div>
<div class="hideable" id="create">Div 3</div>
Run Code Online (Sandbox Code Playgroud)
但它说,div.style undefined.为什么?:)
我有一个用javascript格式化的表单,这使得数字看起来像:
10.000或2.300
<form>
<input type="text" name="price_1" value="2.300">
</form>
Run Code Online (Sandbox Code Playgroud)
但我想将它们存储在没有点的mysql中.如何删除它们?
mysql_query("INSERT INTO prices price_a='price_1' WHERE id ='price_id'");
Run Code Online (Sandbox Code Playgroud)
我看到money_format和number_format,但它只是格式化数字不删除任何东西.
问题很简单,如何在 YYYY-MM-DD 格式的日期中添加天数?
例如,将以下格式给出的日期递增:“2013-02-11”到“2013-02-12”?
我的页面上有一些复选框.如果我将其写为已选中,则可以在FF上使用,但不能在Chrome中使用.我想checked=true,checked=checked和checked简单.
这是我的一个复选框:
<input id="downloadscatids_1" class="input_radio" type="checkbox" checked="true" name="downloadscatids_1" onclick="set_downloadscatids();">
Run Code Online (Sandbox Code Playgroud)