我暂时没有完成HTML和CSS,所以我可能会遗忘一些东西,但由于某种原因,即使在最简单的上下文中,带有"text-align"属性集的"style"标签也不起作用.我将向您展示我所拥有的整个文件,但我的问题只出现在我的两条评论中.不要担心其他的东西; 这是我正在努力的一个小小的激情项目.
所以这是整个文件.我有很多东西,不相关也不重要; 只关注两条评论中的代码.
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>JSON Generator</title>
<link rel="stylesheet" href="web_mod.css"></link>
</head>
<body bgColor="#E3E3E3">
<!--Start here-->
<span style="text-align: center">Coded by AnnualMelons</span><br>
<!--Finish here-->
<span style="color: red; background-color: #2CE65A">Use this generator to generate the code required to create a JSON message.<br>
Fill in the blanks to generate the code. The generator will guide you through it as you go along. Have fun!</span>
<script>
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
"由TimesMelons编码"部分应该在中心,但事实并非如此.至少对我而言,事实并非如此.
我知道该文件的其他部分不相关,但我想我可能会告诉你,因为它可能是一个外部问题.
我确定我只是犯了一个愚蠢的错误,因为我暂时没有这样做,但它不起作用......所以是的.我正在使用Firefox作为我的网络浏览器,以防万一.
谢谢!
基本上,我有一个表格,每个单元格都包含一个复选框.我希望能够通过单击单元格内的任何位置来勾选复选框,并更改我已完成的单元格的颜色.
现在的问题是,当我勾选复选框然后取消勾选时,该单元格没有得到那个单元格颜色,就像复选框未被取消时一样,它的单元格颜色应该回到白色.谁能帮我?帮助将受到高度赞赏.
这是我的小提琴http://jsfiddle.net/UcDMW/50/
$(function () {
$('table tr td').on('click', function (e) {
if (e.target.type == "checkbox") {
if ($(this).is(':checked')) {
$(this).attr('checked', false);
$(this).css('background-color', 'white');
} else {
$(this).attr('checked', true);
$(this).css('background-color', '#DFF0D8');
}
return;
} else {
if ($(this).find('input:checkbox').is(':checked')) {
$(this).css('background-color', 'white');
$(this).find('input:checkbox').attr('checked', false);
} else {
$(this).find('input:checkbox').attr('checked', true);
$(this).css('background-color', '#DFF0D8');
}
}
});
});
Run Code Online (Sandbox Code Playgroud) 我想要实现的很简单:按下按钮时,它会创建一个带选项的选择元素.我可以做精选元素,但选项,而不是.我尝试了很多东西.这是我使用的代码,有一些注释可以提供帮助.
<!--This is the element that we append the JavaScript to. The code that achieves the task is at the bottom.-->
<p id="clonePanel"></p>
<script>
//Don't worry about the first pid stuff.
var pid = 0;
function dupPan() {
pid++;
//Here we create a "p" element. The following code is the element's content and specs.
var newPanel = document.createElement("p");
newPanel.id=pid;
//Here we create a "select" element (a drop down list).
var newList = document.createElement("select");
//Here we create a text node.
var …Run Code Online (Sandbox Code Playgroud)