标签: button

IE在单击按钮元素时发送内部HTML

我的网页上有以下html(简体).

<button type="submit" name="action" value="ButtonA">Click Here</button>
Run Code Online (Sandbox Code Playgroud)

在Firefox中,它提交"ButtonA"作为"action"表单值的值.但是,在IE7中,它提交了"Click Here".有什么方法可以解决这个问题吗?我不想使用输入标签,因为我需要能够自定义文本而不影响发送回表单的值(本地化).基本上,我希望能够拥有多个具有相同名称的按钮,并根据它们的值,在提交时执行不同的操作.在这种情况下,让IE正常运行有什么容易吗?

[更多]

也许我应该更清楚,但我不能使用

<input type="submit" name="Action" value="ButtonA">
Run Code Online (Sandbox Code Playgroud)

因为我需要能够更改为本地化规则显示的文本,而不会影响随表单提交的按钮的实际值.

[更多]

更详细地说,基本上,我希望按钮能够根据语言说"保存"或"Sauver",但不会将提交给服务器的值更改.我还希望有多个具有相同名称的按钮,并根据值,执行某些操作,而不是依赖于按钮名称,并测试是否存在该按钮的值.代码已经从这个角度编写了,我只想更改值中显示的文本,而不需要现有的服务器端处理代码.

这是一个非常好的解释问题的链接,有一些可能的解决方法.

html forms internet-explorer input button

8
推荐指数
1
解决办法
2749
查看次数

将ZXing连接到xcode中的按钮

我是编程的新手,所以这个问题我肯定是非常基本的(跟我一起吧!)

我刚刚将zxing安装到我当前的xcode 4.5项目中.我花了一段时间来解决这些错误,但我终于明白了.

我创建了一个名为"scan"的按钮,我想要调用zxing.我怎样才能做到这一点?

我已经尝试查看我在源文件中实现的文件,但无法确定要使用哪些类和方法.

是的,我尝试了谷歌搜索这个非常基本的概念,但没有发现:(

iphone xcode button zxing ios

8
推荐指数
1
解决办法
382
查看次数

Android:在运行时启用/禁用按钮?

好的,所以我有两个按钮.第一个是"加载文本",第二个是"说出来".

现在,我不希望Speak按钮在没有加载文本时处于活动状态.

我已设法通过加载文本按钮的onClickListener方法将值设置为EditText.在我调用的相同方法中,

btnSpeak.setEnabled(true);
Run Code Online (Sandbox Code Playgroud)

我把它初始化为,

btnSpeak = (Button) findViewById(R.id.button1);
Run Code Online (Sandbox Code Playgroud)

整个编码是,

@Override
public void onInit(int status) {

    if (status == TextToSpeech.SUCCESS) {

        int result = tts.setLanguage(Locale.US);

        if (result == TextToSpeech.LANG_MISSING_DATA
        || result == TextToSpeech.LANG_NOT_SUPPORTED) {
            Log.e("TTS", "This Language is not supported");
        } else {
            btnSpeak.setEnabled(true);
            //for checking
            if(btnSpeak.isEnabled())
            {
                Toast.makeText(SimpleAndroidOCRActivity.this, "Button should work!", Toast.LENGTH_SHORT).show();
            }
            else
            {
                Toast.makeText(SimpleAndroidOCRActivity.this, "Button should not work!", Toast.LENGTH_SHORT).show();
            }
        }

    } else {
        Log.e("TTS", "Initilization Failed!");
    }

}
Run Code Online (Sandbox Code Playgroud)

这是为了检查状态并将语言分配给TTS以供进一步使用.我得到祝酒"按钮应该工作",但它没有启用.为什么会这样?有什么工作?

我在.xml文件中,

<Button
    android:id="@+id/button1"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_width="200dp"
    android:enabled="false" …
Run Code Online (Sandbox Code Playgroud)

android runtime button

8
推荐指数
3
解决办法
7万
查看次数

如何启用和禁用Twitter Bootstrap Button?

我试图实现在单击它时禁用按钮,然后在ajax请求成功完成后再次启用它的情况.

以下是我的代码片段.

形成

<button id="btnSubmit" type="submit" class="btn btn-warning btn-lg">Submit!</button>
Run Code Online (Sandbox Code Playgroud)

使用Javascript

$('#resForm').validate({
  // disable submit button
  $('#btnSubmit').prop('disabled', true);

  submitHandler: function(form) {
    $.ajax({
      ..... typical ajax stuff .....
      success: function(data) {
        alert(data);
        $('success').html(data);
        // enable reserve button again
        $('#btnSubmit').prop('disabled', false);
      },
      error: function (jqXHR, textStatus, errorThrown) {
        // console.log(jqXHR);
      }
    });
  }
});
Run Code Online (Sandbox Code Playgroud)

它不起作用.在Chrome上检查我的控制台告诉我Uncaught SyntaxError: Unexpected token (.感觉这在某个地方是一个愚蠢的错误,我无法弄明白.我已经阅读prop过jQuery 1.6.1及更高版本,我在1.8.3.

javascript jquery button twitter-bootstrap

8
推荐指数
1
解决办法
3万
查看次数

tkinter按钮的高度和宽度

我正在尝试使用下面的代码创建一个按钮并更改高度和宽度,但实际按钮不会在物理上显示.但是,如果您将鼠标悬停在它应该是的区域上并单击它将打开新窗口.有任何想法吗?

import sys
from tkinter import *

#main menu
def mmWindow():
    mmWindow=Tk()
    mmWindow.geometry('600x600')


#first window   
mWindow= Tk()
mWindow.geometry('1920x1080+0+0')
mWindow.title('DMX512 Controller')

wtitle = Label (mWindow, text = "Pi DMX", fg = 'blue')
wtitle.place(x = 640, y = 100)

#main menu button
mmbutton = Button (mWindow, text = "Main Menu",command = mmWindow)
mmbutton.place( x=200, y = 200)
mmbutton.config(width=200, height=200)
Run Code Online (Sandbox Code Playgroud)

python tkinter button

8
推荐指数
1
解决办法
3万
查看次数

如何以编程方式在活动中选择RadioButton

在我的项目中,我从数据库中获得性别的值为0和1.
0表示男性,1表示女性.
根据这个值,我需要检查RadioGroup中相应的RadioButton.
如果按0,将检查radio0或检查radio1.
我不知道如何根据这个字符串值检查单选按钮...
这是我试过的代码:

      String gendd=ViewProfileActivity.participantview.get(4);
      System.out.println("Gender:::::"+gendd);

      male=(RadioButton)findViewById(R.id.radio0);
       female=(RadioButton)findViewById(R.id.radio1);
       if(gendd.equals("0")){

           male.setSelected(true);
           female.setSelected(false);
       }
       else
           {
           male.setSelected(false);

           female.setSelected(true);

           }
Run Code Online (Sandbox Code Playgroud)

但它失败了.谁能帮我?

android button selected radio

8
推荐指数
2
解决办法
2万
查看次数

Button没有包装其内容

我使用一个简单的水平LinearLayout将3个按钮放在一起,宽度相同.我通过以下xml文本实现此目的:

   <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/activity_vertical_margin"
            android:baselineAligned="false" >

            <Button
                android:id="@+id/help"
                style="android:buttonBarButtonStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/help" />

            <Button
                android:id="@+id/close"
                style="android:buttonBarButtonStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/closemultigame" />

            <Button
                android:id="@+id/ok"
                style="android:buttonBarButtonStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/restartmultigame" />

        </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

现在布局看起来像这样: 设计师截图

按钮layout_height定义为wrap_content,但最右边的按钮不包含其内容.它在不同的设备上看起来不同,有些看起来不错.我实际想要实现的是三个按钮,相同的宽度和相同的高度,每个按钮的文本水平和垂直居中.你会提出什么方法?

增加:按要求的整个布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/activity_horizontal_margin" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:drawableLeft="@drawable/matchandfit"
        android:drawablePadding="@dimen/activity_horizontal_margin"
        android:gravity="center_vertical"
        android:padding="@dimen/activity_horizontal_margin"
        android:text="@string/multigameover"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/status"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="@string/multigameresult"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <LinearLayout
        android:id="@+id/masterresult"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/masterresultinfo" …
Run Code Online (Sandbox Code Playgroud)

layout android button

8
推荐指数
3
解决办法
9780
查看次数

如何为ImageButton添加阴影?

这是我第一次发帖.我一直在使用这个网站作为一个很好的资源.但我遇到了一个问题.我尝试过将阴影效果应用到我的ImageButton但是它有效吗?我想要实现的是你可以在浮动气泡上看到的阴影(材料设计).我有一个圆形的ImageButton,但我希望在它周围添加一个阴影.我怎样才能做到这一点?

这是circle_button.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#C62666"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

这是circle_button_pressed.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#E92D6C"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

这是我的选择器,它将两个drawable组合成一个.button.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/circle_button"
        android:state_focused="true"
        android:state_pressed="true" />
    <item android:drawable="@drawable/circle_button_pressed"
        android:state_focused="false"
        android:state_pressed="true" />
    <item android:drawable="@drawable/circle_button_pressed"
            android:state_focused="true" />
    <item android:drawable="@drawable/circle_button"
        android:state_focused="false"
        android:state_pressed="false" />
</selector>
Run Code Online (Sandbox Code Playgroud)

这就是我将它应用到我的ImageButton的方式

<ImageButton
           android:id="@+id/btn_apply"
           android:layout_width="68dp"
           android:layout_height="68dp"
           android:layout_alignParentTop="true"
           android:layout_alignRight="@+id/scrollView1"
           android:layout_marginRight="45dp"
           android:layout_marginTop="94dp"
           android:adjustViewBounds="true"
           android:background="@drawable/button"
           android:scaleType="fitCenter"
           android:src="@drawable/apply_two" />
Run Code Online (Sandbox Code Playgroud)

又一次呢?如何在按钮上添加阴影?谢谢你的时间.

html css java android button

8
推荐指数
1
解决办法
8385
查看次数

如何删除v7工具栏后退按钮

我需要从我的活动中删除这个v7工具栏:

在此输入图像描述

请帮我 !

android button android-button

8
推荐指数
1
解决办法
1万
查看次数

Xamarin表单 - 制作按钮出现在页面底部

我正在玩一个Xamarin表单试图让一个按钮出现在页面底部.这是我的xaml ......

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:control="clr-namespace:RMG.InView.Device.Shared;assembly=RMG.InView.Device"
             x:Class="RMG.InView.Device.Shared.PinCodeControlDemoPage">
  <StackLayout>
    <Label Text="Enter A Code" VerticalOptions="Center" HorizontalOptions="Center" />
    <Button Text="Reveal Code" x:Name="RevealCode" Clicked="RevealCode_OnClicked" VerticalOptions="End" ></Button>
  </StackLayout>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)

我将VerticalOptions设置为End,但按钮出现在屏幕中间.

在此输入图像描述

如何使按钮粘在屏幕底部?

button xamarin xamarin.forms

8
推荐指数
1
解决办法
1万
查看次数