Change Background color of input field using JavaScript

I am making a form and making input field to read only using JavaScript. I want to change the default color for read only attribute to green or yellow. HTML <input type="radio" name="sex" value="male">Male<br/> <input type="radio" name="sex" value="female">Female <br/> Age:<input type="text" name="age" id="age" size="20"> Hobbies:<input type="text" name="hobbi

使用JavaScript更改输入字段的背景颜色

我正在制作一个表单,并使输入字段只能使用JavaScript进行读取。 我想将只读属性的默认颜色更改为绿色或黄色。 HTML <input type="radio" name="sex" value="male">Male<br/> <input type="radio" name="sex" value="female">Female <br/> Age:<input type="text" name="age" id="age" size="20"> Hobbies:<input type="text" name="hobbies" id="hobbies" size="20"><br/> Phone:

Javascript How do i compare two values and then change background color?

Why doesn't this code work? I want it to change the color of the input background whether the value is correct (green) or not (red). <html> <head> <script type="text/javascript"> function funct1 () { var username = "63XZ4"; if(username == document.getElementById('keygen').value ) { document.getElementById('keygen').style.backgroundColor = '#5bc556'; } else { colorchange.

Javascript如何比较两个值然后更改背景颜色?

为什么这个代码不工作? 我希望它改变输入背景的颜色,无论值是否正确(绿色)或不是(红色)。 <html> <head> <script type="text/javascript"> function funct1 () { var username = "63XZ4"; if(username == document.getElementById('keygen').value ) { document.getElementById('keygen').style.backgroundColor = '#5bc556'; } else { colorchange.style.backgroundColor = 'red'; } } return 0; &l

different styling for words

I'm having problem with placeholders. I want to ask, is there possibility to style value in input fields but in the way to style words of that value different. For example, if we have input field which have initial value "First Name" i want to have green color for "First" , and red color for "Name" (this is just an example). I met this problem recently but i

不同的文字造型

我遇到占位符问题。 我想问,是否有可能在输入字段中设置样式值,但是如何设置不同值的字样。 例如,如果我们的输入字段的初始值为"First Name"我想为"First"设置green color ,为"Name"为red color (这只是一个示例)。 我最近遇到了这个问题,但我避免这种情况,并以一种风格进行设计。 但现在,我正在研究另一个项目,并且存在同样的问题。 我想知道这是否可能? 注意:因为ie,我

Can I hide the HTML5 number input’s spin box?

Is there a consistent way across browsers to hide the new spin boxes that some browsers (such as Chrome) render for HTML input of type number? I am looking for a CSS or JavaScript method to prevent the up/down arrows from appearing. <input id="test" type="number"> This CSS effectively hides the spin-button for webkit browsers (have tested it in Chrome 7.0.517.44 and Safari Version 5.0.2

我可以隐藏HTML5号码输入的旋转框吗?

在浏览器中是否存在一致的方法来隐藏某些浏览器(例如Chrome)为类型编号的HTML输入呈现的新旋转框? 我正在寻找一种CSS或JavaScript方法来防止出现向上/向下箭头。 <input id="test" type="number"> 这个CSS有效地隐藏了webkit浏览器的旋转按钮(已经在Chrome 7.0.517.44和Safari 5.0.2(6533.18.5)中测试过): input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { /* display: none; <-

Change placeholder color in Javascript for Chrome

As said here : Change an HTML5 input's placeholder color with CSS, Chrome doesn't support the CSS property color for input placeholders. But there is a property named -webkit-input-placeholder . If I put on my CSS : #MyInput::-webkit-input-placeholder { color: blue; } It works. But how can I do this with Javascript (or jQuery) ? Define it in the CSS as you have it, but make it

在Chrome中更改JavaScript的占位符颜色

如上所述:使用CSS更改HTML5输入的占位符颜色,Chrome不支持输入占位符的CSS属性颜色。 但是有一个名为-webkit-input-placeholder的属性。 如果我把我的CSS: #MyInput::-webkit-input-placeholder { color: blue; } 有用。 但我怎么能用Javascript(或jQuery)做到这一点? 在CSS中定义它,但是使它成为#MyInput.blue-placeholder::-webkit-input-placeholder并使用jQuery添加/删除“蓝色占位符”类。 #MyInput.blue-

Using JavaScript to check whether a string contains Japanese characters (including kanji)

How can I check whether a given string contains one or more Japanese characters (consisting of kana and/or kanji)? I saw a similar question here: How can I check if variable contains Chinese/Japanese characters? , and I used the solution to come up with this: var containsJapanese = string.match(/[u3400-u9FBF]/); However, this gives many false positives. I've tested it by having a scrip

使用JavaScript检查一个字符串是否包含日文字符(包括汉字)

如何检查给定的字符串是否包含一个或多个日文字符(由假名和/或汉字组成)? 我在这里看到了类似的问题:如何检查变量是否包含中文/日文字符? ,我用这个解决方案来解决这个问题: var containsJapanese = string.match(/[u3400-u9FBF]/); 但是,这给了很多误报。 我已经通过脚本遍历整个网页的内容来测试它 - 例如Facebook,Stack Overflow等 - 并且标记包含日文文本的div。 在这些情况下,大量的div最终会被误判。

Kendo Grid MVC/ASP.Net Disable a field during edit

I have a Kendo UI grid with various dropdowns. Two columns in particular are Schema and Mapping. The Schema dropdown has a variety of options the user can choose, one of which is "Custom". In this case, I want the Mapping column to be enabled so the user can choose a custom mapping. If the Schema column is selected as anything else, the Mapping column needs to be null'd and disa

Kendo Grid MVC / ASP.Net在编辑期间禁用字段

我有一个具有各种下拉菜单的Kendo UI网格。 两列尤其是Schema和Mapping。 Schema下拉菜单有多种用户可以选择的选项,其中之一是“Custom”。 在这种情况下,我希望启用“映射”列,以便用户可以选择自定义映射。 如果Schema列被选为其他任何内容,则Mapping列需要为空和禁用。 我努力让这个功能按预期工作。 如果我将Events侦听器添加到模型中,我可以按照我的意愿触发javascript函数,但是我似乎无法找到启用或禁用后的属性

Kendo Grid filter event with OData

I have a kendo grid with a dataSource and the dataSource has the following options: type: "odata-v4", serverFiltering: true, serverPaging: true, serverSorting: true Within the grid options I have the following: sortable: true, resizable: true, reorderable: true, filterable: true, filter: function(e) { console.log(e) }, However the filter event never fires. Is it possible to perform server

带有OData的Kendo网格过滤器事件

我有一个剑道格与dataSource和数据源的具有以下选项: type: "odata-v4", serverFiltering: true, serverPaging: true, serverSorting: true 在网格选项中,我有以下几点: sortable: true, resizable: true, reorderable: true, filterable: true, filter: function(e) { console.log(e) }, 但是, filter事件从不会触发。 是否有可能执行服务器端过滤并使filter事件触发? 在dataSource执行任何操作并扩展过滤器之前

AMD + Backbone + JSDoc3 best way to document

I'm looking for the best way to document my code, but I don't find anything. I've see others topics, including this, but there all doesn't resolve my problem. I have something like this: define([ 'backbone' ], function (Backbone) { /** * @module models/products */ /** * Product model * @class */ var Product = Backbone.Model.extend({

AMD + Backbone + JSDoc3文件的最佳方式

我正在寻找记录我的代码的最佳方式,但我没有找到任何东西。 我看到了其他主题,包括这些,但是这些都不能解决我的问题。 我有这样的事情: define([ 'backbone' ], function (Backbone) { /** * @module models/products */ /** * Product model * @class */ var Product = Backbone.Model.extend({ /** @lends Product.prototype */ /** * Some met

JSDoc3: How to document a AMD module that returns a function

I'm trying to find a way to document AMD modules using JSDoc3. /** * Module description. * * @module path/to/module */ define(['jquery', 'underscore'], function (jQuery, _) { /** * @param {string} foo Foo-Description * @param {object} bar Bar-Description */ return function (foo, bar) { // insert code here }; }); Sadly none of the patterns listed on

JSDoc3:如何记录返回函数的AMD模块

我试图找到一种方法来使用JSDoc3来记录AMD模块。 /** * Module description. * * @module path/to/module */ define(['jquery', 'underscore'], function (jQuery, _) { /** * @param {string} foo Foo-Description * @param {object} bar Bar-Description */ return function (foo, bar) { // insert code here }; }); 可悲的是,http://usejsdoc.org/howto-commonjs-modules.html