这是一个简单的代码:
var elements = $('#myDiv').find('a');
Run Code Online (Sandbox Code Playgroud)
假设元素数组包含5个链接.现在我想隐藏数组中的零链接,如下所示:
$(elements[0]).css("display","none");
Run Code Online (Sandbox Code Playgroud)
我知道$(elements [0])是非法的.我可以说:
var selector="#"+elements[0].id
Run Code Online (Sandbox Code Playgroud)
然后
$(selector).css("display","none");
Run Code Online (Sandbox Code Playgroud)
但是,如果没有为其分配id,我该如何引用该元素?
Adobe Dreamweaver - 如何"移动"图像
我正在使用HTML,并且有三张我想要移动的图片,现在它看起来像这样:http: //jonathangurebo.tumblr.com/post/41614799078
如何让它变得更好.我希望它看起来像这样:http: //jonathangurebo.tumblr.com/post/41614824708
我怎么办?我是Dreamweaver的初学者.
我的HTML代码如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jonathan Gurebo</title>
<style type="text/css">
<!--
body {
background-color: #191919;
}
-->
</style></head>
<body>
<center>
<p><img src="Pictures/Jonathan Gurebo.png" width="405" height="76" />
</p>
<p><img src="Pictures/Apps.png" width="128" height="86" />f<img src="Pictures/Contact.png" width="194" height="72" /></p>
<p> </p>
</center>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 这是我正在初始化和构建数组的方式:
var newCountyInfo = new Object();
newCountyInfo.name = newCountyName;
newCountyInfo.state = newCountyState;
newCountyInfo.zips = newCountyZips;
newCountyInfo.branchID = newCountyBranchID;
Run Code Online (Sandbox Code Playgroud)
所以我在数组中有四个元素.然后我将newCountyInfo传递给另一个函数来拉出元素以便在一些HTML元素中显示.
我知道如何获取使用它们的函数中的各个元素的唯一方法是:
JSON.parse(JSON.stringify(newCountyValidation)).name
JSON.parse(JSON.stringify(newCountyValidation)).state
... etc...
Run Code Online (Sandbox Code Playgroud)
必须有更好/更短/更优雅的方式来做到这一点!
它是什么?
我在chrome browser开发者模式下手动更改了style属性,它具有所需的效果.进入
element.style {
width: 900px;
}
Run Code Online (Sandbox Code Playgroud)
之后,被操纵的div显示为:
<div id="rte-savebar" class="aui-toolbar" style="width: 900px;">
Run Code Online (Sandbox Code Playgroud)
现在我正在使用此命令尝试使用javascript的相同效果:
document.getElementById("rte-savebar").style="width:900px;";
Run Code Online (Sandbox Code Playgroud)
这似乎根本没有效果.
为了改变javascript中的宽度,我需要做什么?
所以我有多个具有相同ID'stick'的div。我想遍历所有这些元素并给每个元素一个随机的高度。这是我尝试过的:
<script type="text/javascript">
for(var i = 0; i < 47; i++) {
var rand = 200;
document.getElementsById('stick')[i].style.height= rand+'px';
}
</script>
Run Code Online (Sandbox Code Playgroud)
这段代码不会令人遗憾地工作。我想念什么吗?
谢谢。
1个问题1.说我有这个:
<body>
<form>
<h3>blah</h3>
<table>
<tr>
<th>Input 1:</th>
<td><input type="text" id="some-input-a" name="some-input-a" /></td>
</tr>
<tr>
<th>Input 2:</th>
<td><input type="text" id="other-input" name="other-input" /></td>
</tr>
</table>
<h3>blah</h3>
<table>
<tr>
<th>Input 3:</th>
<td>
<select name="my-select" id="my-select">
<option value="1">My 1</option>
<option value="c">Your f</option>
<option value="m">This g</option>
</select>
</td>
</tr>
<tr>
<th>Input 4:</th>
<td><input type="password" id="pass-input" name="next-input" /></td>
</tr>
<tr>
<th>Input 5:</th>
<td><input type="password" id="pass-confirm" name="pass-confirm" /></td>
</tr>
</table>
<h3>blah</h3>
<table>
<tr>
<th>Input 6:</th>
<td><input type="text" id="next-one" name="next-one" /></td>
</tr>
<tr>
<th>Input 7:</th>
<td><input type="text" …
Run Code Online (Sandbox Code Playgroud) 我有一个矢量例如test<-c("red","blue","green")
.我怎样才能将矢量的元素加入到我所拥有的元素中test<-c("red/blue/green")
.
我知道我可以使用,paste(test[1],test[2],test[3], sep="/")
但这太多了,因为我的矢量有数百个元素!
谢谢你的帮助!
我有这个6x6矩阵,
1 1 2 1 2 2
1 3 1 1 2 1
0 5 1 1 0 3
0 5 0 2 1 3
4 1 3 3 2 3
2 3 3 0 2 3
Run Code Online (Sandbox Code Playgroud)
我需要找到一种方法来选择所有值> 0,这样我就可以创建一个大于0的所有元素的向量.有一个简单的方法吗?
我想知道如何检查浏览器中是否启用了Javascript.我需要这样做以避免服务器端验证.