请原谅我的英文
我在网站上工作,而且我使用了很多JS。今天我的脚本有问题。我正在使用这个网站:http://jsfiddle.net我在将脚本调整到我的网站时遇到了问题。
这是剧本:
$(document).ready(function() {
$('#unseen1').click(function() {
$(':radio').wrap("<span style='background-color:#009999' />");
var score = 0;
if ($('input[name=1a]:checked').val().length != 0)
{
score++;
$('input[name=1a]:checked').wrap("<span style='background-color:green' />");
}
else
{
$('input[name=1a]:checked').wrap("<span style='background-color:red' />");
}
if ($('input[name=2a]:checked').val().length != 0)
{
score++;
$('input[name=2a]:checked').wrap("<span style='background-color:green' />");
}
else
{
$('input[name=2a]:checked').wrap("<span style='background-color:red' />");
}
if ($('input[name=3a]:checked').val().length != 0)
{
score++;
$('input[name=3a]:checked').wrap("<span style='background-color:green' />");
}
else
{
$('input[name=3a]:checked').wrap("<span style='background-color:red' />");
}
if ($('input[name=4a]:checked').val().length != 0)
{
score++;
$('input[name=4a]:checked').wrap("<span style='background-color:green' />");
}
else
{
$('input[name=4a]:checked').wrap("<span style='background-color:red' />");
}
alert("Your score is " + (score * 25));
if (score == 4)
{
alert("Good work");
}
});
});
它适用于此代码:
<p> 1. How do the drivers help the operating system? </p>
<input type="radio" name="1a" value="">a. They hold it's hand.</input><br>
<input type="radio" name="1a" value="">b. They save data.</input><br>
<input type="radio" name="1a" value="1">c. They tell how to contol devices.</input><br>
<input type="radio" name="1a" value="">d. They send information to the CPU and recive information from the HDD.</input><br><br>
<p> 2. What is uniqe about Windows 2000 and XP? </p>
<input type="radio" name="2a" value="">a.They send information to the drivers. </input><br>
<input type="radio" name="2a" value="">b. They come with an expansion card. </input><br>
<input type="radio" name="2a" value="">c. They don't recognize drivers. </input><br>
<input type="radio" name="2a" value="1">d.they come with a large driver database </input><br><br>
<p> 3. What is plug-and-play? </p>
<input type="radio" name="3a" value="1">a. It's when you connect a device or an expansion card and don't need to install it's driver.</input><br>
<input type="radio" name="3a" value="">b. It's when you plug a guitar and can play it on the computer. </input><br>
<input type="radio" name="3a" value="">c. It's a name of a driver. </input><br>
<input type="radio" name="3a" value="">d. It's when you play the pluger. </input><br><br>
<p> 4. The newest Microsoft operating system has... </p>
<input type="radio" name="4a" value="">a. The biggest drivers. </input><br>
<input type="radio" name="4a" value="">b. The heavist programs. </input><br>
<input type="radio" name="4a" value="">c. The oldest drivers. </input><br>
<input type="radio" name="4a" value="1">d. The most recent drivers. </input><br><br>
<center><button type="submit" id="unseen1" class= "orange" >check</button></center><br>
不幸的是,这个脚本只适用于1.7.1 JQuery,我的网站只能以1.6.2的方式工作(我有一个侧边栏,我正在使用隐藏和显示选项,似乎不适用于1.7。 1 JQuery)
如何更改脚本以便它可以在JQuery 1.6.2上运行?
如果您需要更多信息,请问我