JavaScriptを使用して確認ボックスのボタンラベルを変更するにはどうすればよいですか?
確認ボックスのボタンラベルを変更するには、次のコードを実行してみてください。このコードは、JavaScriptライブラリjQueryとCSSを使用して、標準の確認ボックスとは異なるボタンラベルの確認ボックスを作成します-
例
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script>
function functionConfirm(msg, myYes, myNo)
{
var confirmBox = $("#confirm");
confirmBox.find(".message").text(msg);
confirmBox.find(".yes,.no").unbind().click(function()
{
confirmBox.hide();
});
confirmBox.find(".yes").click(myYes);
confirmBox.find(".no").click(myNo);
confirmBox.show();
}
</script>
<style>
#confirm
{
display: none;
background-color: #91FF00;
border: 1px solid #aaa;
position: fixed;
width: 250px;
left: 50%;
margin-left: -100px;
padding: 6px 8px 8px;
box-sizing: border-box;
text-align: center;
}
#confirm button {
background-color: #48E5DA;
display: inline-block;
border-radius: 5px;
border: 1px solid #aaa;
padding: 5px;
text-align: center;
width: 100px;
cursor: pointer;
}
#confirm .message
{
text-align: left;
}
</style>
</head>
<body>
<div id="confirm">
<div class="message"></div>
<button class="yes">Like!</button>
<button class="no">No, I Like Cricket!</button>
</div>
<button onclick = 'functionConfirm("Do you like Football?", function yes()
{
alert("Yes")
}, function no()
{
alert("no")
});'>submit</button>
</body>
</html> -
Swiftを使用してボタンの背景色を変更するにはどうすればよいですか?
iOSアプリケーションでボタンの背景色を変更するには、UIButtonのプロパティ「backgroundColor」にアクセスする必要があります。これは、プログラムとストーリーボードの2つの方法で実行できます。 方法1-ストーリーボードエディタを使用する ストーリーボードにボタンを追加し、それを選択します。属性インスペクターに移動し、[背景]プロパティを選択して色を選択します。 方法2-プログラムで背景を変更する ViewControllerにボタンのアウトレットを作成します。 viewDidLoad()またはviewWillLayoutSubview()メソッドで、背景色を変更するコー
-
ボタンを押したときにTkinterラベルのテキストを変更するにはどうすればよいですか?
ほとんどの場合、Tkinter Labelウィジェットは、テキストまたは画像を表示するためにアプリケーションで使用されます。 config(** options)を使用して、テキストプロパティ、色、背景色、前景色などのラベルウィジェットを構成できます。 メソッド。 ラベルウィジェットを動的に変更または変更する必要がある場合は、ボタンと関数を使用してラベルウィジェットのテキストを変更できます。 例 # Import the required libraries from tkinter import * # Create an instance of tkinter frame or wi