这是我的ManagedBean:
@Named(value = "mrBean")
@RequestScoped
public class MrBean {
public void laugh() {
System.out.println("HAHAHA");
}
public void prepareToLaugh() {
System.out.println("Drink water.");
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的commandButton的工作版本:
<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
value="Laugh" oncomplete="laughButton.disable();" />
Run Code Online (Sandbox Code Playgroud)
当我点击上面的按钮时,我看到HAHAHA了按钮被禁用.但是,当我将laughButton的disable属性设置为时true,该按钮不再起作用:
<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
value="Laugh" disabled="true" oncomplete="laughButton.disable();" />
<p:commandButton actionListener="#{mrBean.prepareToLaugh}"
value="Prepare to laugh" oncomplete="laughButton.enable();" />
Run Code Online (Sandbox Code Playgroud)
当我点击第二个按钮时,我看到Drink water并启用了第一个按钮.但是,当我点击第一个按钮时,没有任何反应.
如果有人能就如何解决这个问题给我一个建议,我将非常感激.我正在使用PrimeFaces 3.0 RC2.
我正在使用wpf c#Window.我有一个像这样定义的按钮:
<Button x:Name="but" Style="{DynamicResource ButtonStyle13}" / >
Run Code Online (Sandbox Code Playgroud)
我的ButtonStyle是这样的:
<VisualState x:Name="Pressed">
//bla bla (my style) goes here
Run Code Online (Sandbox Code Playgroud)
现在,当我使用这种视觉状态时,按下按钮时视觉正在改变但后来恢复正常.我希望按钮处于"按下"状态,它将保持"按下"直到我按下另一个按钮.
我尝试像这样改变它:
<VisualState x:Name="myPre">
Run Code Online (Sandbox Code Playgroud)
然后在代码中使用:
VisualStateManager.GoToElementState(but, "myPre", true);
Run Code Online (Sandbox Code Playgroud)
完全没有剂量.然后我用了
VisualStateManager.GoToState(but, "myPre", true);
Run Code Online (Sandbox Code Playgroud)
只要鼠标悬停在按钮上,这就会按下我的按钮,但是当它失去焦点(鼠标移动)时,它会恢复正常.
我希望我已经清楚了.如何使按钮保持在按下的视觉状态,直到我决定(在代码内)取消该按钮?
我们有一个表格,在表格之前我们有两个复选框.
我想要做的是(无法通过复选框验证)是禁用提交按钮,直到两个复选框都被选中.
这些的HTML是:
<label class="s_radio"><input type="checkbox" class="required" id="terms"/> <a class="s_main_color" href="/terms">Terms</a></label>
<label class="s_radio"><input type="checkbox" class="required" id="privacy"/> <a class="s_main_color" href="/privacy">Privacy Policy</a></label>
Run Code Online (Sandbox Code Playgroud)
用于验证这些的js(虽然不起作用)
if(terms == "") $('#terms').css({"outline-color":"#F12B63"});
if(privacy == "") $('#privacy').css({"outline-color":"#F12B63"});
Run Code Online (Sandbox Code Playgroud) 我需要同时使用它们(fancybox按钮助手和缩略图助手)
我一次只能使用其中一个.
以下是每个功能的示例:http: //fancyapps.com/fancybox/#examples
已经尝试过使用这两个类:
<a class="fancybox-buttons fancybox-thumbs"
Run Code Online (Sandbox Code Playgroud)
但它不起作用......一次只有一个,如:
<a class="fancybox-buttons"
Run Code Online (Sandbox Code Playgroud)
要么
<a class="fancybox-thumbs"
Run Code Online (Sandbox Code Playgroud)
.
这些是每个的javascripts:
/*
Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length …Run Code Online (Sandbox Code Playgroud) 在Android中,我有一个包含图像和文本的按钮.禁用该按钮时,文本将自动显示为灰色,但图像保持不变.如果禁用按钮而没有两个单独的图像,是否可以使图像变暗?
我有一个按钮
<Button
android:layout_above="@id/choice2"
android:layout_centerHorizontal="true"
android:textColor="#FFFF00"
android:textSize="25sp"
android:gravity="center"
android:background="@drawable/loginbutton"
android:layout_height="30dp"
android:layout_width="fill_parent"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/q1a1"
android:id="@+id/choice1">
</Button>
Run Code Online (Sandbox Code Playgroud)
当你按下这个按钮时,它会向计数器/记分员增加10.如何使此按钮能够被按下一次,但之后又不能按下?用户可以多次作弊并按下该按钮,以便为该分数添加更多内容.
在我的ASP.NET页面中,我使用的是"FileUpload"控件.整个事情已经实现并且按预期工作但是...我不希望TextBox控件是"FileUpload"的一部分.(FileUpload = TextBox + Button)
是否有可能只删除/隐藏TextBox并让Button看起来像LinkButton?
谢谢
有人能告诉我这里我做错了什么吗?
我试图在单击按钮时执行一个功能.
HTML:
<button id="btn1">Press me!</button>
<input type="button" id="btn2" value="Press me!"/>?
Run Code Online (Sandbox Code Playgroud)
javascript:
var btn1 = document.getElementById('btn1'),
btn2 = document.getElementById('btn2');
function do() {
alert('Yay!');
}
btn1.onclick = do;
btn2.onclick = do;?
Run Code Online (Sandbox Code Playgroud)
这是一个演示.我不确定为什么它不起作用.对于我来说,这显然是一种显而易见的方式.:)
在Java中工作:我有一个JFrame类,我的两个单独的类JPanels被添加到JFrame.其中一个JPanel类中有一些按钮,可以互相交互(当我点击一个按钮时,它可以禁用另一个按钮).但是,我无法弄清楚如何让按钮在另一个中调用一个方法JPanel(在一个单独的类中编写).
所以,我的程序看起来像这样:
的JFrame
任何提示赞赏,谢谢!
有人可以告诉我如何禁用Android中的按钮,除非所有三个editText字段都填满了吗?我不知道在这里包含条件语句的位置以及如何将它放在按钮侦听器的上下文中.
这是我的主要活动代码.
package com.amritayalur.mypowerschool;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MyPowerSchoolActivity extends Activity {
Button buttonSubmit;
TextView textViewTitle;
TextView textViewDesc;
EditText editTextURL, editTextUser, editTextPass;
String url = "";
String str;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonSubmit = (Button) findViewById(R.id.buttonSubmit);
textViewTitle = (TextView) findViewById(R.id.textViewTitle);
textViewDesc = (TextView) findViewById(R.id.textViewDesc);
editTextURL = (EditText) …Run Code Online (Sandbox Code Playgroud) button ×10
android ×3
jquery ×2
asp.net ×1
fancybox ×1
file-upload ×1
function ×1
helper ×1
hide ×1
html ×1
image ×1
imagebutton ×1
java ×1
javascript ×1
jsf ×1
layout ×1
methods ×1
oop ×1
primefaces ×1
swing ×1
textbox ×1
thumbnails ×1
view ×1
wpf ×1