嗨,所以我有一个简单的表格,其中一个表的值来自数据库,当我尝试通过样式表在表格上应用样式时,它不适用。但是我在下面的表格中为按钮设置的样式正在应用。
这是我的代码:
Sheets("ULA2").Select
Range("F2").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F4").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F5").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F6").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F7").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F8").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F9").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F10").Select
ActiveCell.FormulaR1C1 = "ULA2"
Range("F11").Select
LastRow = Cells(Rows.Count, "F").End(xlUp).Row
Range("F2").AutoFill Destination:=Range("F2:F" & LastRow), Type:=xlFillDefault
Sheets("BO").Select
Range("F2").Select
ActiveCell.FormulaR1C1 = "BO"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F"), Type:=xlFillDefault
Range("F2:F").Select
这是我的样式表:
<?php
include('SQLFunction.php');
?>
<html>
<head>
<title>CreateTask</title>
<meta http-equiv=content-type content="text/html; charset=utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="css/bootstrap.css" rel="stylesheet"/>
<link href="css/bootstrap-grid.css" rel="stylesheet"/>
<link href="css/bootstrap-reboot.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body>
<span>
<h1>New Task</h1>
<form action="addTaskSubmit.php" method="POST" class="center" class="test">
<div class="form-group row">
<label class="col-sm-2 col-form-label">Title: </label>
<div class="col-sm-10">
<input class="form-control" type="text" name="TaskTitle" maxlenght='50' required>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Description:</label>
<textarea style="width:70%" type="text" class="form-control rounded-0" name='TaskDesc' rows="10"
maxlength='1000' required></textarea>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Destination:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="TaskDest" maxlength="150">
</div>
<label class="col-sm-2 col-form-label">Nextrun:</label>
<div class="col-sm-10">
<input class="form-control" type="datetime-local" name="TaskNextRun" required>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Cron:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="TaskCron" maxlength="=50">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Enabled</label>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="radio" name="TaskEnabled" id="gridRadios1" value="true"
required>
<label class="form-check-label" for="gridRadios1">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="TaskEnabled" id="gridRadios1" value="false">
<label class="form-check-label" for="gridRadios1">No</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">parentTicket:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="TaskParentTicket" maxlength="10">
</div>
<label class="col-sm-2 col-form-label">groupTicket:</label>
<div class="col-sm-10">
<input class="form-control" type="test" name="TaskGroupTicket" maxlength="150" required>
</div>
<label class="col-sm-2 col-form-label">lastCreatedTicket:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="TaskLastCreatedTicket" maxlength="10">
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" name="addButton" class="btn btn-primary">Add</button>
</div>
</div>
</form>
</span>
<h1>IT Task Main View</h1>
<?php
$sql = "SELECT TOP 15 *
from dbo.SCHEDULE
order by id desc";
//echo '<br>Sql :' .$sql.'<br>We will comment this out after testing<br>';
$link = connectMSDB();
$getResult = $link->prepare($sql);
$getResult->execute();
$result = $getResult->fetchAll(PDO::FETCH_BOTH);
echo "<div >";
echo "<table class=\"table table-hover\" style='width:85%; margin-left:auto; margin-right:auto;'>";
echo "<thead>";
echo "<tr>";
echo "<th>Action</th>";
echo "<th>Title</th>";
echo "<th>Description</th>";
echo "<th>Destination</th>";
echo "<th>Next Run</th>";
echo "<th>Cron</th>";
echo "<th>Enabled</th>";
echo "<th>Parent Ticket</th>";
echo "<th>Group Ticket</th>";
echo "<th>Last Created Ticket</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
foreach ($result as $row) {
$desc = substr($row['description'], 0, 200);
echo "<tr>";
echo "<td><form action='UpdateTask.php' method='POST' onsubmit=''/><input type='hidden' name='q' value='" . $row['id'] . "'/>
<button type='submit' class=\"btn btn-update\" >Update</button></form>";
echo "<form action='DeleteTask.php' method='POST' onsubmit=''/><input type='hidden' name='q' value='" . $row['id'] . "'/>
<button type='submit' class=\"btn btn-delete\" style=''>Delete</button></form></td>";
echo "<td>{$row['title']}</td>";
echo "<td>{$desc}</td>";
echo "<td>{$row['destination']}</td>";
echo "<td>{$row['nextrun']}</td>";
echo "<td>{$row['cron']}</td>";
echo "<td>{$row['enabled']}</td>";
echo "<td>{$row['parentTicket']}</td>";
echo "<td>{$row['groupTicket']}</td>";
echo "<td>{$row['lastCreatedTicket']}</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
$link = null;
?>
<script src="js/bootstrap.bundle.js"></script>
</body>
</html>
因此,类bnt-update,btn-update:hover,btn-delete和btn-delete:hover起作用,但类测试无效。
奇怪的是,如果我直接将样式添加到form标签中,它会起作用吗?
我做错了什么?
感谢您的帮助
答案 0 :(得分:3)
这里的问题在开始表单标签中找到。您曾经使用过class属性两次,而您应该只使用一次并且用空格将类分开。以下应该起作用:
<form action="addTaskSubmit.php" method="POST" class="center test">
答案 1 :(得分:1)
我注意到了一些问题
class="center" class="test"
而不是写class="center test"
type="test"
中输入了TaskGroupTicket
,而不是type="text"
maxlength
中拼错了TaskTitle
gridRadios1
两次。那是无效的HTML,它导致您的“否” <label>
选中“是”单选按钮