关于javascript-动态更新ExtjsautoEl:’button’文本和CSS和js动态更新数据的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于asp.net–Javascript
关于javascript-动态更新Extjs autoEl:’button’文本和CSS和js动态更新数据的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于asp.net – Javascript之前asp:ButtonField点击、Autocomplete Textbox Example javascript实现自动完成成功_javascript技巧、button没写type=button会导致点击时提交_javascript技巧、CSS Button调用javascript函数等相关知识的信息别忘了在本站进行查找喔。
本文目录一览:- javascript-动态更新Extjs autoEl:’button’文本和CSS(js动态更新数据)
- asp.net – Javascript之前asp:ButtonField点击
- Autocomplete Textbox Example javascript实现自动完成成功_javascript技巧
- button没写type=button会导致点击时提交_javascript技巧
- CSS Button调用javascript函数
javascript-动态更新Extjs autoEl:’button’文本和CSS(js动态更新数据)
我是ExtJS的新手,想动态更改按钮的文本:
我的要求是预览按钮.为了提供预览,我创建了如下组件:
{
xtype: ''container'',
width: ''100%'',
padding: ''20 0 20 0'',
itemId: ''preview-container'',
items: [
{
xtype: ''component'',
itemId: ''preview'',
autoEl :''button''
}
]
}
我的更新预览方法如下,我想从此函数更新按钮的文本:
我已经尝试过如下,但无法正常工作..
updatePreview: function () {
var previewEl = this.down(''#preview'').getEl(),
formValues = this.getForm().getValues(),
newStyles = {};
if (previewEl) {
previewEl.text = formValues.name;
previewEl.applyStyles(newStyles);
}
}
更新:包括我所有的代码示例
Ext.widget({
xtype : ''mz-form-widget'',
itemId: ''specialButtonRuleForm'',
defaults: {
xtype: ''textfield'',
editable: false,
listeners: {
change: function (cmp) {
// alert(1);
cmp.up(''#specialButtonRuleForm'').updatePreview();
}
}
},
items: [
{
xtype: ''textfield'',
name: ''name'',
fieldLabel: ''Button label'',
allowBlank: false
},
{
xtype: ''container'',
width: ''100%'',
padding: ''20 0 20 0'',
itemId: ''preview-container'',
items: [
{
xtype: ''component'',
itemId: ''preview'',
autoEl :''button''
}
]
}
],
listeners: {
afterrender: function (cmp) {
// alert(2);
cmp.updatePreview();
}
},
updatePreview: function () {
// alert(3);
var previewEl = this.down(''[itemId=preview]''),
formValues = this.getForm().getValues(),
newStyles = {};
if (previewEl) {
previewEl.setText(formValues.name);
previewEl.applyStyles(newStyles);
}
}
});
解决方法:
因为使用的是组件,所以没有通常的按钮方法.
您将需要做PreviewEl.getEl().dom.value =’New Text’;
总结
以上是小编为你收集整理的javascript-动态更新Extjs autoEl:’button’文本和CSS全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
原文地址:https://codeday.me/bug/20191028/1955750.html
asp.net – Javascript之前asp:ButtonField点击
在到达OnRowDelete事件之前有没有办法执行一段JavaScript?
删除行之前,我只需要一个简单的确认。
谢谢!
编辑:请注意< asp:ButtonField>标签没有OnClientClick属性。
解决方法
在这些按钮之一中,我将使用OnClientClick属性在此之前执行JavaScript确认对话框。
<script type="text/javascript"> function confirmDelete() { return confirm("Are you sure you want to delete this?"); } </script> ... <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="DeleteButton" runat="server" ImageUrl="..." AlternateText="Delete" ToolTip="Delete" CommandName="Delete" CommandArgument='<%# Eval("ID") %>' OnClientClick="return confirmDelete();" /> </ItemTemplate> </asp:TemplateField>
Autocomplete Textbox Example javascript实现自动完成成功_javascript技巧
<script> <BR>var isOpera = navigator.userAgent.indexOf("Opera") > -1; <BR>var isIE = navigator.userAgent.indexOf("MSIE") > 1 && !isOpera; <BR>var isMoz = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !isOpera; <BR>function textboxSelect (oTextbox, iStart, iEnd) { <BR> switch(arguments.length) { <BR> case 1: <BR> oTextbox.select(); <BR> break; <BR> case 2: <BR> iEnd = oTextbox.value.length; <BR> /* falls through */ <br><br> case 3: <BR> if (isIE) { <BR> var oRange = oTextbox.createTextRange(); <BR> oRange.moveStart("character", iStart); <BR> oRange.moveEnd("character", -oTextbox.value.length + iEnd); <BR> oRange.select(); <BR> } else if (isMoz){ <BR> oTextbox.setSelectionRange(iStart, iEnd); <BR> } <BR> } <BR> oTextbox.focus(); <BR>} <BR>/* <BR>function textboxReplaceSelect (oTextbox, sText) { <BR> if (isIE) { <BR> var oRange = oTextbox.createTextRange(); <BR> oRange.text = sText; <BR> oRange.collapse(true); <BR> oRange.select(); <BR> } else if (isMoz) { <BR> var iStart = oTextbox.selectionStart; <BR> oTextbox.value = oTextbox.value.substring(0, iStart) + sText + oTextbox.value.substring(oTextbox.selectionEnd, oTextbox.value.length); <BR> oTextbox.setSelectionRange(iStart + sText.length, iStart + sText.length); <BR> } <BR> oTextbox.focus(); <BR>} <BR>*/ <BR>function autocompleteMatch (sText, arrValues) { <BR> for (var i=0; i < arrValues.length; i++) { <BR> if (arrValues[i].indexOf(sText) == 0) { <BR> return arrValues[i]; <BR> } <BR> } <BR> return null; <BR>} <BR>function autocomplete(oTextbox, oEvent, arrValues) { <BR> switch (oEvent.keyCode) { <BR> case 38: //up arrow <BR> case 40: //down arrow <BR> case 37: //left arrow <BR> case 39: //right arrow <BR> case 33: //page up <BR> case 34: //page down <BR> case 36: //home <BR> case 35: //end <BR> case 13: //enter <BR> case 9: //tab <BR> case 27: //esc <BR> case 16: //shift <BR> case 17: //ctrl <BR> case 18: //alt <BR> case 20: //caps lock <BR> case 8: //backspace <BR> case 46: //delete <BR> return true; <BR> break; <BR> default: <BR> // 下面这一行用处不大(被注释) <BR> //textboxReplaceSelect(oTextbox, isIE ? oTextbox.value/*oEvent.keyCode*/ : oEvent.charCode); <BR> var iLen = oTextbox.value.length; <BR> var sMatch = autocompleteMatch(oTextbox.value, arrValues); <BR> if (sMatch != null) { <BR> oTextbox.value = sMatch; <BR> textboxSelect(oTextbox, iLen, oTextbox.value.length); <BR> } <br><br> return false; <BR> } <BR>} <BR> </script>
<script> <BR> var arrValues = ["red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown"]; <BR> </script>
Autocomplete Textbox Example
Type in a color in lowercase:输入一个以小写字母开头的颜色(英文单词,比如:r、 b等)
button没写type=button会导致点击时提交_javascript技巧
有个地方很奇怪:点击了一个弹窗中的按钮,没想到弹窗消失了,经公司的js高手调试,发现了其中的奥秘