0

我有一个网站,上面有以下 PHP:

echo "<form action='choice.php' method='post'>";
echo "<input type='submit' name='choice' value='left' /> ";

我正在使用引导程序并想知道如何将引导程序样式应用于这些按钮?我只会添加一个,但我不确定如何。或者使用复制此功能的引导按钮会更好吗?如果有怎么办?

4

3 回答 3

1

要使用引导按钮类,请尝试以下操作:

echo "<input type='submit' class='btn btn-primary' name='choice' value='left' /> ";
于 2013-11-12T17:56:43.847 回答
0

Go with andre3wap's answer if you want to keep using the <input> element. But for completeness sake, if you want to replace it with a <button> element:

Change:

echo "<input type='submit' name='choice' value='left' /> ";

to:

echo "<button class='btn btn-primary' type='submit' name='choice'>left</button>";

Twitter bootstrap does support more types of buttons, check: http://getbootstrap.com/css/#buttons for all the button styles.

于 2013-11-12T18:02:41.040 回答
0

You can EASILY do this by just adding the right attributes to the code:

echo '<button class="btn btn-primary" type="submit" name="choice">left</button>';

Notice I changed from input to button because it is more semantic, though if you you are developing for IE6 then go back to input.

于 2013-11-12T18:26:57.963 回答