【发布时间】:2014-01-31 20:49:53
【问题描述】:
在 Coda 2 中,我可以链接到 css,但是当我链接到很多东西时,它不起作用,因为没有任何反应,尤其是使用 jquery。这有什么问题? Btw here it is so far in jsbin if it matters
main.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="planets.css">
<script src="planets.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<title>Planets</title>
</head>
planets.js:
$('#submit').click(function () {
var checkedPlanet = $("input[name='planets']:checked").val();
$("input:radio").attr("checked", false);
var age = document.getElementById('age').value;
var newAge;
if(checkedPlanet==='mercury'){
newAge = Math.round(age/0.241);
alert("You would be"+" "+newAge+" "+ "years old on Mercury!");
}
if(checkedPlanet==='venus'){
newAge = Math.round(age/0.615);
alert("You would be"+" "+newAge+" "+ "years old on Venus!");
}
if(checkedPlanet==='earth'){
alert('You would be'+" "+ age*1+" " +'on Earth! Duh!');
}
if(checkedPlanet==='mars'){
newAge=Math.round(age/1.88);
alert("You would be"+" "+newAge+" "+ "years old on Mars!");
}
if(checkedPlanet==='jupiter'){}
});
【问题讨论】:
-
定义“它不起作用”。不行怎么办?此外,您发布的 jsbin 链接与您在此处发布的代码有很大不同;
link和script标签的数量不同。什么不起作用?
标签: javascript jquery coda