当提交按钮的name属性正好"提交"时,我无法在提交表单时提交.
这是代码:
<input onclick="checkForm(document.form_29) && document.form_29.submit();" value="Submit" name="submit" type="button">
请注意,我们没有使用标准输入类型的"提交",而是使用JavaScript作为"按钮"的输入类型,在验证脚本(checkForm)返回true之后使用JavaScript来提交表单.
奇怪的是,当且仅当name属性为"submit"时,这将不起作用.该问题区分大小写,因此以下(以及任何其他命名,包括无名称属性)将起作用:
<input onclick="checkForm(document.form_29) && document.form_29.submit();" value="Submit" name="Submit" type="button">
我一直在查看W3C规范中提到的保留名称,但我找不到任何东西.我怀疑我在这里忽略了一些非常明显的东西,所以我希望你们中的一些人能看到一些我无法看到的东西.
谢谢你的帮助.
我有一个带按钮的表格.此应用程序旨在在触摸屏计算机上运行.单击按钮时,我想知道它是否被鼠标或触摸屏点击.
这可能吗?如果是这样,怎么样?
我想在我的Android应用程序中使用Button但我想自定义它的外观.但是,我希望按钮的高亮和选定颜色与默认颜色相同(即深色和浅橙色渐变,或主题颜色提供的任何颜色).
无论如何都要获得默认的高亮/选定的drawable并将其用作所选和突出显示状态下按钮的填充?
谢谢!
如何检测用户是否按下音量硬件按钮并防止默认行为?
非常感谢.
什么是最好,最强大的CSS按钮定义?
理想情况下,我喜欢渐变,圆润的图像,以及优雅的降级到IE8.如果按钮不使用任何图像,并且按钮水平缩放以适合其内容,那也将是很好的.
什么是最好的解决方案?
我想将按钮放在具有动态文本的各个位置(不在导航栏中).我希望它们看起来类似于黑色导航栏按钮项目(灰色和黑色渐变).
我将如何创建这些?它们需要基于按钮文本的动态宽度.我知道我可以创建png文件并拉伸它们,但是有更好的方法吗?
这是我正在使用的代码:
-(void)viewDidLoad
{
NSString *checkerPath = [[NSBundle mainBundle] pathForResource:@"black-yellow-checker" ofType:@"png"];
UIImage *checkerImage = [[UIImage alloc] initWithContentsOfFile:checkerPath];
checkerView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 230.0f, 320.0f, 280.0f)];
[checkerView setImage:checkerImage];
UIButton *backButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
backButton.frame = CGRectMake(45.0f, 175.0f, 230.0f, 50.0f);
[backButton setBackgroundImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"yellowButton" ofType:@"png"]] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(goBackHome:) forControlEvents:UIControlEventTouchDown];
[backButton setTitle:@"Back" forState:UIControlStateNormal];
backButton.titleLabel.font = [UIFont fontWithName:@"Marker Felt" size:30];
backButton.titleLabel.textColor = [UIColor blackColor];
[checkerView addSubview:backButton];
}
- (void)goBackHome:(id)sender
{
NSLog(@"go back pressed");
}
Run Code Online (Sandbox Code Playgroud)
不知道为什么这不起作用.按钮出现,但是当我按下按钮时没有任何反应.当我触摸它时,它甚至不会改变为"缩进"图像.没有.不能使用IB,必须以编程方式.有什么想法吗?
我正在研究Android XML中的布局,我想在设置填充父级时设置按钮高度以匹配它的宽度.显然这个数字会根据屏幕大小而改变,所以我不能使用设定的像素大小.有人可以帮助我根据屏幕尺寸获取按钮宽度,然后将其传递到高度设置吗?
谢谢,乔希

什么在世界上可以给我这个额外的〜5-6像素的间距?这让我很生气,我尝试在父TableRow上设置填充/边距,每个按钮,文本视图,一切!
这是显示的XML布局:
<TableLayout android:id="@+id/tableLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" >
<TextView android:text="Resource1 - $Price" android:id="@+id/resourceText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="3"></TextView>
<Button android:text="@string/buybtn" android:id="@+id/buyButton1" android:onClick="buyButtonClick" android:layout_width="80dip" android:layout_height="36dip"></Button>
<TextView android:text="XXX" android:id="@+id/resourceHeld1" android:layout_width="30dip" android:layout_height="wrap_content" android:gravity="center"></TextView>
<Button android:text="@string/sellbtn" android:id="@+id/sellButton1" android:onClick="sellButtonClick" android:layout_width="80dip" android:layout_height="36dip"></Button>
</TableRow>
<View android:layout_height="1dip" android:background="#FF303030"/>
<TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:text="Resource2 - $Price" android:id="@+id/resourceText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="3"></TextView>
<Button android:text="@string/buybtn" android:id="@+id/buyButton2" android:onClick="buyButtonClick" android:layout_width="80dip" android:layout_height="36dip"></Button>
<TextView android:text="XXX" android:id="@+id/resourceHeld2" android:layout_width="30dip" android:layout_height="wrap_content" android:gravity="center"></TextView>
<Button android:text="@string/sellbtn" android:id="@+id/sellButton2" android:onClick="sellButtonClick" android:layout_width="80dip" android:layout_height="36dip"></Button>
</TableRow>
etc etc etc copypasta
Run Code Online (Sandbox Code Playgroud)
我需要牺牲哪些鸡肉来填充那些填充物?在一个理想的世界中,我会轻轻推动1dip视图,在按钮底部有一个1dip的边距.
我最近参加了Qt编程,并希望将我的应用程序移植到Qt.
我正在摆弄QPushButtons并且我设法在按钮中显示图像并将一些文本设置到按钮,但无论我做什么,无论有没有设计师,我都有同样的问题,文本对齐到图标而不是覆盖图标.
addButton = new QPushButton();
addButton->setIcon(QIcon(":/AddButton.png"));
addButton->setText(tr("+"));
addButton->setFlat(true);
addButton->setIconSize(QSize(100,90));
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我知道有toolButton但它似乎没有"平面"属性.
有什么好主意吗?
非常感谢,
麦克风