我可以防止"onblur"事件中的选择丢失吗?
<!DOCTYPE html>
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset=utf-8">
<script type = "text/javascript">
window.onload = function () {
var textarea = document.getElementsByTagName ("textarea")[0];
textarea.onblur = function () {
alert ("Should keep selection");
return false;
}
}
</script>
<title>Select me !</title>
</head>
<body>
<textarea>Select me !</textarea>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
谢谢/
这是一个Oracle问题.
我需要在一系列记录中找到前五大值.假设我有2000条记录,并且有一列保存每条记录中的数字值.我需要检查这个数字字段,并且只选择前5位.
所以,如果我在我的数字列中有这些值
22
3
44
2
23
9
4
2
99
Run Code Online (Sandbox Code Playgroud)
然后将返回以下内容
22
44
23
9
99
Run Code Online (Sandbox Code Playgroud)
我目前不得不解析字段中的数字值,因为它是一个字符串.我用以下内容解析它
REGEXP_SUBSTR(SUBSTR(ADDITIONAL_INFO, 1 ,
INSTR(ADDITIONAL_INFO, ',', 1,1)), '[0-9]+') "CELLS"
Run Code Online (Sandbox Code Playgroud)
我想可能会出现循环,如果涉及其他选择.如果这是C#,我可以在几分钟内完成.但是Oracle语法让我失望.
请帮忙.
问题:有没有一种简单的方法可以使用jFrame上的向上/向下按钮对jList进行排序?我的JList存储图像文件的路径,并显示带有文件名的字符串.我想通过单击向上/向上按钮向下/向上移动元素.
这就是我所做的 - 效果是移动选择(蓝色区域),而不是元素.Button2是按钮"向上".
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int indexOfSelected = jList1.getSelectedIndex();
File selectedFile = (File) jList1.getSelectedValue();
indexOfSelected = indexOfSelected - 1;
jList1.setSelectedIndex(indexOfSelected );
jList1.updateUI();
}
Run Code Online (Sandbox Code Playgroud)
这就是JList的创建方式:
public void openButtonActionPerformed() {
fc.setMultiSelectionEnabled(true);
int returnVal = fc.showDialog(null, "Open");
if (returnVal == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFiles();
len = file.length;
System.out.println(len);
}
for (i=0; i<len; i++){
listModel.add(i, file[i]);
}
jList1.setModel(listModel);
jList1.updateUI();
}
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助和耐心 - 提前.我是个傻瓜:)
我坚持一些我希望你能帮助我的东西.我在WordPress上使用滑块插件,需要控制每个缩略图.我想为div中的每个子元素添加一个唯一的ID,这样我就可以使用CSS来设置它.
这是代码的样子:
<div class="royalControlNavCenterer">
<a class="current" href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
</div>
Run Code Online (Sandbox Code Playgroud)
如您所见,插件已添加当前类.我正在寻找的是类似地,动态地为每个元素添加一个类,所以它看起来如下:
<div class="royalControlNavCenterer">
<a id="1" class="current" href="#">1</a>
<a id="2" href="#">2</a>
<a id="3" href="#">3</a>
<a id="4" href="#">4</a>
<a id="5" href="#">5</a>
</div>
Run Code Online (Sandbox Code Playgroud)
这样我就可以分别设计每个缩略图,这是我的设计所需要的.我认为jQuery将是最好的选择,但我愿意接受任何建议.
任何帮助是极大的赞赏!
我有一个分配给div的jquery datepicker,我目前正在使用它仅显示日历,并且不希望能够选择datepicker上的任何项目。
最简单的方法是什么?
编辑:澄清一下,我正在使用Jquery UI datepicker。用户应该不能选择月,年,日等,也无法获得手形图标。我仍然可以使用jquery分配选定的日期等
datepicker日历始终显示。
我得到了一张包含各种数据的表格.在一栏中,我们发现了某种不时出现的项目编号.我想创建包含每个项目编号的列表.
所以我考虑创建一个数组并将数字添加到它中,如果现有数组中还没有它.
最后,数组应该显示在表格中
这是我到目前为止所得到的:
Sub ChoseNumbers()
' Chosing the Numbers in the AreaDim Arr() As Integer
Dim i As Integer
Dim area As Range
Set area = Columns("N").cells
i = 0
For Each cell In area
If IsEmpty(cell) Then
Exit For
ElseIf i = 0 Then
ReDim Preserve Arr(i)
Arr(UBound(Arr)) = cell.Value
i = i + 1
ElseIf IsInArray(cell.Value, Arr) = False Then
ReDim Preserve Arr(i)
Arr(UBound(Arr)) = cell
i = i + 1
End If
Next cell
'Giving the …Run Code Online (Sandbox Code Playgroud) 在我的手机应用程序中,我需要一个ActionSheet,其中有多个按钮部分,并且可以选择每个部分中的一个按钮。一个带有“确定”按钮的整体。
首先,我有一个打开ActionSheet的方法:
-(void)showActionSheet{
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles: nil];
for(int i = 0; i < [selectionArray count]; i++){
ObjektGroup *groupArray = [selectionArray objectAtIndex:i];
for(int j = 0; j < [groupArray count]; j++){
[sheet addButtonWithTitle:nameofbuttonbla];
}
[sheet addButtonWithTitle:@"------------------"];
}
[sheet addButtonWithTitle:@"OK"];
sheet.cancelButtonIndex = sheet.numberOfButtons-1;
[sheet showInView:self.view];
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我是动态添加按钮的。那很好,但是节设计([sheet addButtonWithTitle:@"------------------"];)器不是我想要的最终解决方案。那么有可能像分组的tableView一样分组吗?+我只希望每个部分选择一个按钮。
另一个问题是以下方法被调用时:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{}
Run Code Online (Sandbox Code Playgroud)
该Actionsheet全自动驳回。我也想避免这种情况。
有任何想法吗?
我在脚本中有一个变量,它有几行单个单词
说$loremipsums的基本上是这样的:
something1
something2
something3
something4
Run Code Online (Sandbox Code Playgroud)
现在$loremipsums是动态的; 它可以更多或更少,并且可以是不同的值,具体取决于它从某个文件中读取的内容.我还想使用用户在变量中选择的内容.
我想动态地将它们变成选项选择菜单.我在这里找到了一个显示基本的:https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
现在我需要动态地完成它.如您所见,它们是通过该示例手动设置的.
这是我想要的一个例子:
1) michael
2) richard
3) steven
4) robert
5) exit
Please enter your choice: 4
You have chosen robert
Run Code Online (Sandbox Code Playgroud) 如何在javascript中收集对象数组,例如我在这种情况下有这个数组:
var abc = [{"name": "udin", "checked": true}, {"name": "kabayan": "checked": true}, {"name": "hebring"}];
Run Code Online (Sandbox Code Playgroud)
如何得到这样的结果:
abc = [{"name": "udin", "checked": true}, {"name": "kabayan": "checked": true}];
Run Code Online (Sandbox Code Playgroud)
我只想显示"checked"== true的元素
这个问题归结为需要<textarea>在指令中获取元素的光标位置.简而言之,我需要在此工作.
var position = element.selectionStart;
Run Code Online (Sandbox Code Playgroud)
关于主题至少有5个答案使用各种方法,例如这个用于角度,这个用于一些jQuery扩展,在这里输入链接描述.
我已经阅读了所有内容,并决定尝试获取选择开始对象.这是我的PLNKR.我不知道我做错了什么.注意 - 背景改变的东西是看我是否选择了正确的元素,我就是这样.这里编辑是失败的代码片段:
link: function(scope, elem, attrs) {
var textArea = elem.find("#itemTextArea");
textArea.bind('click', function() {
//This gets to undefined, even though selectionStart is a property of textarea*
scope.testValue = elem.selectionStart;
});
},
Run Code Online (Sandbox Code Playgroud)
*https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Property/selectionStart
PS单击文本区域以立即知道指令中发生了什么.