Notice: register_sidebar的调用方法不正确。“边栏1”侧边栏的参数数组中未设置id,缺省为“sidebar-1”。要消除此通知并保持现有的侧边栏内容,请手动将id设置为“sidebar-1”。 请查阅调试WordPress来获取更多信息。 (这个消息是在4.2.0版本添加的。) in /data/htdocs/seven2_blog/wp-includes/functions.php on line 3853
jQeury 虚拟键盘插件( jQuery Keypad ) | Seventwo Blog
Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /data/htdocs/seven2_blog/wp-includes/plugin.php on line 601

jQeury 虚拟键盘插件( jQuery Keypad )

2011-02-23 | 分类: jQuery
昨天上午根据自己的需求去找了一个安全虚拟键盘(Virtual Keyboard),看到这个需求第一时间就会想到去 jQuery Plugins(http://plugins.jquery.com) 找这个插件,也许我习惯的原因,也许是我过于依懒 jQuery 吧。通过 jQuery Plugin 平台和 Google 找到几款虚拟键盘出来筛选,最终敲定了jQuery Keypad (http://keith-wood.name/keypad.html),她可以满足我自定样式、数字键随机排位、功能的名称可定义、键也是自定义的。最终修改的外观如图:
jquery virtual keyboard
温馨提示:原来的 jQuery Keypad 切换大/小写的数字键也会重新排位的,可能有参数定义吧,我可能是我太累不愿意花太多时间去看看手册和代码,后来发给小林童鞋修改切换大/小写的数字键重新排位的问题。
JS代码( 别忘了先加载 jQuery 和jQuery Keypad 及其样式文件啊):

$(function () {
	$('#defaultKeypad').keypad({keypadOnly: true, showOn: 'both',
							    buttonImageOnly: true, buttonImage: 'keypad.png',
								randomiseNumeric: true, closeText: '关闭',clearText:'清除',
								shiftText:'大/小写', layout: [
		  							'1234567890' + $.keypad.BACK,
		  							'qwertyuiop' + $.keypad.CLEAR,
		  							'asdfghjkl%' + $.keypad.CLOSE,
		  							'zxcvbnm@#$' + $.keypad.SHIFT

		  						]});

});

参数说明:
buttonText: ‘…’, // Display text for trigger button
buttonStatus: ‘Open the keypad’, // Status text for trigger button
closeText: ‘Close’, // Display text for close link
closeStatus: ‘Close the panel’, // Status text for close link
clearText: ‘Clear’, // Display text for clear link
clearStatus: ‘Erase the current entry’, // Status text for clear link
backText: ‘Back’, // Display text for back link
backStatus: ‘Erase the previous character’, // Status text for back link
enterText: ‘Enter’, // Display text for carriage return
enterStatus: ‘Carriage return’, // Status text for carriage return
tabText: ‘Tab’, // Display text for tab
tabStatus: ‘Horizontal tab’, // Status text for tab
shiftText: ‘Shift’, // Display text for shift link
shiftStatus: ‘Toggle upper/lower case characters’, // Status text for shift link
alphabeticLayout: this.qwertyAlphabetic, // Default layout for alphabetic characters
fullLayout: this.qwertyLayout, // Default layout for full keyboard
isAlphabetic: this.isAlphabetic, // Function to determine if character is alphabetic
isNumeric: this.isNumeric, // Function to determine if character is numeric
isRTL: false, // True if right-to-left language, false if left-to-right

showOn: ‘focus’, // ‘focus’ for popup on focus,
// ‘button’ for trigger button, or ‘both’ for either
buttonImage: ”, // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
showAnim: ‘show’, // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
duration: ‘normal’, // Duration of display/closure
appendText: ”, // Display text following the input box, e.g. showing the format
useThemeRoller: false, // True to add ThemeRoller classes
keypadClass: ”, // Additional CSS class for the keypad for an instance
prompt: ”, // Display text at the top of the keypad
layout: [‘123’ + this.CLOSE, ‘456’ + this.CLEAR,
‘789’ + this.BACK, this.SPACE + ‘0’], // Layout of keys
separator: ”, // Separator character between keys
target: null, // Input target for an inline keypad
keypadOnly: true, // True for entry only via the keypad, false for keyboard too
randomiseAlphabetic: false, // True to randomise the alphabetic key positions, false to keep in order
randomiseNumeric: false, // True to randomise the numeric key positions, false to keep in order
randomiseOther: false, // True to randomise the other key positions, false to keep in order
randomiseAll: false, // True to randomise all key positions, false to keep in order
beforeShow: null, // Callback before showing the keypad
onKeypress: null, // Define a callback function when a key is selected
onClose: null // Define a callback function when the panel is closed

标签: