我无法通过简单的功能更改按钮的颜色,颜色根本不会改变.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="JavaScript">
function changeColor(){
document.getElementsByTagName('button').style.backgroundColor="green";
}
</script>
</head>
<body >
<form action="/action_page.php" method="get" name="form1">
<input type="text" id="campoDeFlores">
<button type="button" onclick="changeColor()" name="1">1</button>
<button type="button" name="2">2</button>
<button type="button" name="3">3</button>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
知道为什么它不起作用吗?
我有一个Xamarin.Forms共享项目,我正在使用UI(XAML).我想在我的应用程序中使用SVG图像作为按钮图像.问题是我不知道该怎么做.如果有人会告诉我如何一步一步地做到这一点,我将不胜感激.
在此处输入图像说明我正在尝试创建一个带有圆圈图标的FAB按钮.我想用图标中显示的图标填充整个按钮,但Android似乎总是在图标和按钮之间添加空格.有人可以解释一下如何摆脱这个空间吗?我的应用程序中有多个FAB按钮,我只想用其中一个按钮执行此操作.如何通过设置按钮的属性或以编程方式执行此操作?谢谢!
import UIKit
import GoogleMaps
import FirebaseDatabase
import GeoFire
class MapViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate {
var mapView = GMSMapView()
var locationManager: CLLocationManager!
let regionRadius: CLLocationDistance = 1000
var place = CLLocationCoordinate2D()
@IBOutlet var myLocationButton: UIButton!
@IBOutlet var infoWindow: UIView!
@IBOutlet var postTitle: UILabel!
@IBOutlet var postImage: UIImageView!
var showing = false;
var pins = [String: Pin]()
var currentMarker = GMSMarker()
override func viewDidLoad() {
super.viewDidLoad()
// sets up the map view (camera, location tracker etc.)
let camera = GMSCameraPosition.camera(withLatitude: place.latitude, longitude: …Run Code Online (Sandbox Code Playgroud) 我想添加多个自定义控件按钮,以便我可以向按钮添加自定义单击事件.我遇到的问题是只显示删除按钮.我希望每一行都显示编辑和删除按钮.我有以下代码:
<script>
$( document ).ready(function() {
$("#jsGrid").jsGrid({
height: "auto",
width: "100%",
sorting: true,
paging: true,
autoload: true,
pageSize: 10,
pageButtonCount: 5,
deleteConfirm: "Do you really want to delete your job listing?",
controller: {
loadData: function(filter) {
return $.ajax({
type: "GET",
url: "<?php echo site_url('/job/getjobs/'.$this->session->employer_id); ?>",
data: filter
});
},
},
fields: [
{ name: "id", title: "id", type: "text", visible: false, width: 100 },
{ name: "title", title: "Title", type: "text", width: 100 },
{ name: "created_on", title: "Created On", …Run Code Online (Sandbox Code Playgroud) 我有一个RaisedButtons的ListView,其中每个RaisedButton都是这样的.name每个RaisedButton 的变量都不同:
new RaisedButton(
onPressed: _navigateToRoute,
child: new Text(name),
),
Run Code Online (Sandbox Code Playgroud)
点击RaisedButton调用_navigateToRoute():
void _navigateToRoute() {
Navigator.of(context).push(new MaterialPageRoute<Null>(
builder: (BuildContext context) {
return new Scaffold(
body: new Text('A value with the word "Hello" should go here'),
);
},
));
}
Run Code Online (Sandbox Code Playgroud)
当一个特定的RaisedButton被点击时(例如,让我们说我们点击ListView中的第一个RaisedButton,在哪里name = 'Hello'),我想将name变量传递给新路由.我怎么做?是否有存储的方式name在context变?我应该使用另一个小部件而不是RaisedButton吗?
我可以使用命名导航器路由,但我不想为ListView中的每个项目硬编码路由.
我发现了这个Github问题,我不确定这是否与我遇到的情况相同.
我的Style适用于我的应用程序的所有按钮:
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse x:Name="StatusButtonCircle" Stroke="Black" StrokeThickness="0" Fill="AliceBlue" Stretch="Uniform">
<Ellipse.Width>
<Binding ElementName="StatusButtonCircle" Path="ActualHeight"/>
</Ellipse.Width>
</Ellipse>
<Ellipse x:Name="StatusButtonCircleHighlight" Margin="4" Stroke="Black" StrokeThickness="2" Stretch="Uniform">
<Ellipse.Width>
<Binding ElementName="StatusButtonCircleHighlight" Path="ActualHeight"/>
</Ellipse.Width>
</Ellipse>
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
... some Triggers here
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
如何在XAML中更改属性(例如FontWeight,FontSize等)?我试过这个:
<Button FontWeight="Bold" FontSize="30" Foreground="Red">
</Button>
Run Code Online (Sandbox Code Playgroud)
在设计师视图中,我看到了变化.但在运行期间,这些更改不会应用.
经过一番调查,我也有一个Style for all TextBlock,如下所示:
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="16" /> …Run Code Online (Sandbox Code Playgroud) 我最近才陷入困境,到目前为止,我一直很喜欢它,但是我一直在进行一些UI更改。任何帮助表示赞赏!
我的目标是得到一个圆形按钮,该按钮带有蓝色背景的图标,但外面有一个较深的蓝色边框。附有图片。
我的方法是:
我陷入了第3步,因为我不知道如何添加边框,或者考虑到我解决问题的方式,是否还有可能。目前,具体颜色对我来说并不重要,稍后我将更改主题。
这是我目前有代码明智的地方:
var messageBtn = new Row(
children: <Widget>[
new Padding(
padding: const EdgeInsets.all(20.0),
child: new RawMaterialButton(
onPressed: _messages,
child: new Padding(
padding: const EdgeInsets.all(20.0),
child: new Icon(
Icons.message,
size: 30.0,
color: Colors.white,
),
),
shape: new CircleBorder(),
fillColor: Colors.deepPurple,
),
),
new Padding(
padding: const EdgeInsets.all(8.0),
child: new Text(
'Send Messages',
style: new TextStyle(
fontSize: 20.0,
),
)),
],
);
Run Code Online (Sandbox Code Playgroud)
产生此结果:请参阅屏幕截图
我想要这个:请看第二张截图
这是我试过的css:
.button {
-fx-background-radius: 4;
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.7), 10, 0, 0, 1);
-fx-background-insets: 0, 1;
-fx-padding: 5 20 5 20;
}Run Code Online (Sandbox Code Playgroud)
<div class="button">Nouvea</div>Run Code Online (Sandbox Code Playgroud)
这就是我想要的效果:
我和我的同事在一个包含“常见问题”页面的网站上工作。每个问题之后,都有一个“ Answer”(Antwoord)扰流器按钮。单击按钮将在当前问题下方和下一个问题上方显示答案。再次单击按钮将隐藏答案。这样可以轻松滚动浏览所有问题列表,找到您可能感兴趣的问题。
现在我面临的问题是我想从问题1的答案链接到例如问题5的答案。
我可以给<div>包含问题5的id=属性提供一个链接到该属性的属性,但理想情况下,我想通过使超链接“单击”“答案”按钮来立即显示答案。
事实证明,为了使其能够正常工作,我将需要修改复选框hack,但是我面临一个问题,即我无法在一条文本上同时拥有超链接和标签。
明确一点:我正在寻找仅使用HTML / CSS 的解决方案。
我的原始代码只有一个扰流按钮
.spoilerbutton {
display: block;
border: none;
padding: 0px 0px;
margin: 10px 0px;
font-size: 150%;
font-weight: bold;
color: #000000;
background-color: transparent;
outline: 0;
}
.spoiler {
overflow: hidden;
}
.spoiler>div {
-webkit-transition: all 0s ease;
-moz-transition: margin 0s ease;
-o-transition: all 0s ease;
transition: margin 0s ease;
}
.spoilerbutton[value="Antwoord"]+.spoiler>div {
margin-top: -500%;
}
.spoilerbutton[value="Hide Antwoord"]+.spoiler {
padding: 5px;
}Run Code Online (Sandbox Code Playgroud)
<strong>1. Question 1?</strong> <input class="spoilerbutton" …Run Code Online (Sandbox Code Playgroud)button ×10
css ×2
flutter ×2
html ×2
xaml ×2
android ×1
border ×1
dart ×1
gmsmapview ×1
google-maps ×1
hyperlink ×1
icons ×1
ios ×1
javafx ×1
javascript ×1
jquery ×1
jsgrid ×1
listview ×1
parameters ×1
properties ×1
show-hide ×1
svg ×1
swift ×1
wpf ×1