我不能用prev改变css,我的错误在哪里?Fiddlelink
坦克寻找!
CSS:
.i1 {
float: right;
height: 18px;
margin-top: 6px;
}
label {
border-bottom: 1px dotted #CCCCCC;
clear: both;
float: left;
height: 25px;
margin: 5px 0 0;
width: 450px;
line-height: 32px;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<label>Titel:<input class="i1" type="text" name="titel" value="" /></label>
<label>Vorname:<input class="i1" type="text" name="vorname" value="" /></label>
<label>Nachname:<input class="i1" type="text" name="nachname" value="" /></label>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("input").focus(function () {
$(this).prev("label").css("border-bottom", "1px dotted #63aec4");
});
Run Code Online (Sandbox Code Playgroud) 我想在搜索后滚动到壁橱标记。Console.log 显示 pin[i] = (50.296322, 9.112082) 和事件 (50.937531, 6.9602786)。我尝试了很多,但总是得到:无法读取未定义的属性(读取“球形”)
function geocodeAddress(geocoder, resultsMap){
var address = document.getElementById('address').value;
geocoder.geocode({'address': address}, function(results, status){
if (status === 'OK') {
function find_closest_marker(event){
var distances = [];
var closest = -1;
for(i = 0; i < pins.length; i++){
var d = google.maps.geometry.spherical.computeDistanceBetween(pins[i].position, event);
distances[i] = d;
if (closest == -1 || d < distances[closest]){
closest = i;
}
}
resultsMap.setCenter(pins[closest].position);
}
find_closest_marker(results[0].geometry.location);
} else {
alert('Geocode was not successful for the following reason: ' + status); …Run Code Online (Sandbox Code Playgroud)