出于某种原因,我的警报无效?如果我使用NSLog(@" %@ ", url)它的罚款......但这里没有警报:
- (void)alertURL:(NSURL *)url {
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: url message: @"Error sending your info to the server" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
[self alertURL:url];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
谁能指出我哪里出错:(
我试图在Android中显示两个edittext字段的警报.来源如下:
public void UserPass(){
final SharedPreferences prefs=getSharedPreferences("PrefsPreferences",MODE_PRIVATE);
String user=prefs.getString("user", "");
String pass=prefs.getString("password", "");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("U/P");
builder.setCancelable(false);
final EditText input1 = new EditText(this);
final EditText input2 = new EditText(this);
builder.setView(input1);
builder.setView(input2);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//My code
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
Run Code Online (Sandbox Code Playgroud)
只显示一个EditText.我究竟做错了什么?
谢谢!
我有一个奇怪的问题.我正在尝试使用Javascript从多维数组中获取一些值,它给了我一些奇怪的输出.
这是我的代码:
foo = [['3','4'],['5','6']];
for (bar in foo) {
baz = bar[0];
alert(baz);
qux = bar[1];
alert(qux);
}
Run Code Online (Sandbox Code Playgroud)
以下是上述输出:
// These are all alerts, by the way
0,undefined,1,undefined,$,f,$,c,e,a,c,l,c,l,i,i,n,a,s,l,i,c,o,a,p,g,e,g,e,i,n,c,o,e,r,e,m,f,l,p,i,h,e,r,g
Run Code Online (Sandbox Code Playgroud)
有人能告诉我发生了什么吗?
这是问题的一个问题:http://jsfiddle.net/Jey6w/
编辑:
这是另一个jsFiddle,另一层"Inception":http://jsfiddle.net/8vyGq/
输出:
// Again, these are all alerts, and * signifies undefined
0**1**$ff$ceaacllcllinnassliicooappgeegeeinncooerremmfllpiiheergg
Run Code Online (Sandbox Code Playgroud) 我现在有这个.
//other stuff up here - not important
echo "<td><form action='redeem.php' method='post' id='form'><input type='hidden' name='redeem' value='1' /><input type='hidden' name='id' value='" . $id . "' /><input type='submit' name='Redeem' value='Redeem'></form></td>";
} else {
echo "<td><form action='redeem.php' method='post' id='form'><input type='hidden' name='redeem' value='0' /><input type='hidden' name='id' value='" . $id . "' /><input type='submit' name='Un-Redeem' value='Un-Redeem'></form></td>";
//other stuff down here - not important
Run Code Online (Sandbox Code Playgroud)
我想改变它,以便当您按下:
a)"兑换"提交按钮时,它会提醒您说:"您确定要兑换吗?"
b)"Un-Redeem"SUBMIT按钮,它会提醒您:"您确定要取消兑换吗?"
我已经尝试了其中一些,包括提交上的ONCLICK,但没有一个工作..我相信这是因为我在ECHO中有它,我不得不删除阻止该功能发生的(")引号.
有人知道我能做到的另一种方式吗?
我在制作警报对话框时遇到困难,其代码如下:
public void setp2(View v){
p2 = (TextView)findViewById(R.id.p2);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getApplicationContext());
alertDialogBuilder.setTitle("Please enter player 2 name");
alertDialogBuilder.setMessage("MESSAGE");
alertDialogBuilder.setCancelable(false);
alertDialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
AlertDialog alert = alertDialogBuilder.create();
alert.show();
}
Run Code Online (Sandbox Code Playgroud)
每当我运行它时崩溃logcat看起来像:
04-14 06:09:36.282: E/Trace(25945): error opening trace file: No such file or directory (2)
04-14 06:09:37.822: E/AndroidRuntime(25945): FATAL EXCEPTION: main
04-14 06:09:37.822: E/AndroidRuntime(25945): java.lang.IllegalStateException: Could not execute method of the activity
04-14 06:09:37.822: E/AndroidRuntime(25945): …Run Code Online (Sandbox Code Playgroud) I have this t1 as a text view. I want to store the value of t1 in a variable but i am getting "Type mismatch: cannot convert from void to Integer" error
Integer res=t1.setText(Integer.toString(result));
任何人都可以帮我理解原因:
<?php $x = 'b'; ?>
<script> var v=<?php echo $x;?>; alert(v);</script>
Run Code Online (Sandbox Code Playgroud)
没有弹出警报,而
<?php $x = '3'; ?>
<script> var v=<?php echo $x;?>; alert(v);</script>
Run Code Online (Sandbox Code Playgroud)
会弹出带有文字3的警报吗?
我正在尝试创建一个仅打开警报的简单应用。所以想象一下
int main(int argc, const char * argv[]) {
int result = SomeMagicAlertFunction("Hello World", "Yes", "No");
printf("User picked: %d¥n", result);
}
Run Code Online (Sandbox Code Playgroud)
我已经找到了一些有关的信息,NSAlert但是所有示例都是针对完整的OSX Apps的,其中包含一个应用程序包,例如
+-MyApp.app
|
+-Contents
|
+-MacOS
|
+-MyApp
Run Code Online (Sandbox Code Playgroud)
等等,但是我只想在命令行应用程序中发出警报。一个文件,而不是应用程序包。在OSX的C / C ++或Objective C中可能吗?我看到了一些有关的内容,NSRunAlertPanel但已在优胜美地删除,并说要使用NSAlert。
我正在尝试从我制作的类中显示AlertController.由于AlertController是UIResponder的子类,我使用Xcode建议我的以下代码行
superclass?.presentViewController(alertController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但我无法编译,因为AnyClass?没有任何成员presentViewController.我的类是NSObject的子类.
还有其他方法吗?谢谢
我有一个表单,允许用户从数据库中删除一些数据.
我希望得到一些确认,以防止意外删除.我想做以下事情:
如何才能做到这一点?
我添加了onSubmit警报但它没有显示任何内容,它仍然提交表单.如果用户从警报中选择"是",我怎样才能延迟提交表单?
<form
method="POST"
action="actions/remove-daily-recipient.php"
onSubmit="alert('Are you sure you wish to delete?');"
>
...
</form>
Run Code Online (Sandbox Code Playgroud)