function a(){

document.getElementById("test").value = document.getElementById("test").value.toUpperCase();

}

function b(){

document.getElementById("test2").value = document.getElementById("test2").value.toLowerCase();

}

</script>

<BODY>

在这里输入小写,会自动转为大写:<input type=text id=test onkeyup="a()"><br/>

在这里输入大写,会自动转为小写:<input type=text id=test2 onkeyup="b()">

</BODY>

toLocaleUpperCase 方法
返回一个字符串,其中所有的字母字符都被转换为大写,同时适应宿主环境的当前区域设置。

stringVar.tolocaleUpperCase( )

必选的 stringVar 引用是一个 String 对象,值或文字。

说明
toLocaleUpperCase 方法转换字符串中的字符,同时适应宿主环境的当前区域设置。在大多数情况下,其结果与利用 toUpperCase 方法所得到的结果是一样的。然而,如果语言规则与常规的 Unicode 大小写映射方式冲突,那么结果就会不同。

toLocaleLowerCase 方法
返回一个字符串,其中所有的字母字符都被转换为小写,同时考虑到宿主环境的当前区域设置。

stringVar.tolocaleLowerCase( )

必选的 stringVar 引用是一个 String 对象,值或文字。
说明
toLocaleLowerCase 方法转换字符串中的字符,同时适应宿主环境的当前区域设置。在大多数情况下,其结果与利用 toLowerCase 方法所得到的结果是一样的。然而,如果语言规则与常规的 Unicode 大小写映射方式冲突,那么结果就会不同。

toLowerCase 方法
返回一个字符串,该字符串中的字母被转换为小写字母。

strVariable.toLowerCase( )
"String Literal".toLowerCase( )

说明
toLowerCase 方法对非字母字符不会产生影响。

下面的示例演示了 of the toLowerCase 方法的效果:

var strVariable = "This is a STRING object";
strVariable = strVariable.toLowerCase( );
在执行上一条语句后 strVariable 的值为:
this is a string object

toUpperCase 方法
返回一个字符串,该字符串中的所有字母都被转化为大写字母

strVariable.toUpperCase( )
"String Literal".toUpperCase( )

说明
toUpperCase 方法对非字母字符不会产生影响。

示例
下面的示例演示了 toUpperCase 方法的效果:

var strVariable = "This is a STRING object";
strVariable = strVariable.toUpperCase( );
在执行上一条语句后 strVariable 的值为:
THIS IS A STRING OBJECT

js字母大小写转换的更多相关文章

  1. js中实现字母大小写转换

    js中实现字母大小写转换主要用到了四个js函数: 1.toLocaleUpperCase  2.toUpperCase3.toLocaleLowerCase4.toLowerCase 下面就这四个实现 ...

  2. php 字母大小写转换的函数

    分享下,在php编程中,将字母大小写进行转换的常用函数. 1.将字符串转换成小写strtolower(): 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形式放回这个字符串 2.将字符转成大 ...

  3. css 设置英文字母大小写转换(text-transform)

      css 设置英文字母大小写转换 CreateTime--2018年5月25日07点16分 Author:Marydon 1.实现:通过text-transform实现 2.text-transfo ...

  4. Eclipse_常用技巧_03_字母大小写转换快捷键

    eclipse中字母大小写转换快捷键: ctrl+shift+x 转为大写 ctrl+shift+y 转为小写

  5. AS3.0 字母大小写转换

    字母大小写转换: /** * * *-------------------------* * | *** 字母大小写转换 *** | * *-------------------------* * * ...

  6. Java对字母大小写转换

    Java对字母大小写转换 1.小写——大写String aa = "abc".toUpperCase(); 2.大写——小写 String bb = "ABC" ...

  7. C++进行字母大小写转换

    #include <iostream> #include <Windows.h> #include <string> using namespace std; in ...

  8. eclipse、 IDEA中字母大小写转换快捷键

    eclipse 中字母大小写切换快捷键: ctrl + shift + x     转为大写 ctrl + shift + y     转为小写 IDEA  中字母大小写切换快捷键: ctr + sh ...

  9. PAT 06-2 字符串字母大小写转换

    没什么好说的,记得使用ctype.h就好了,谭浩强那本书就介绍了,再不使用就太对不起他老人家了:有一点小小的地方需要注意一下,&&的优先级比=号高,所以getchar()两边没有括号的 ...

随机推荐

  1. Java 图片切圆角,消除锯齿

    public static BufferedImage setBorderRadius(BufferedImage srcImage, int radius){ int width = srcImag ...

  2. (转)C# DateTime格式化大全

    //c datetime 格式化 DateTime dt = DateTime.Now; Label1.Text = dt.ToString();//2005-11-5 13:21:25 Label2 ...

  3. Asp.Net WebApi+Microsoft.AspNet.WebApi.Core 启用CORS跨域访问

    WebApi中启用CORS跨域访问 1.安装 Nugget包Microsoft.AspNet.WebApi.Cors This package contains the components to e ...

  4. 常用webservice网址

    http://www.gpsso.com/Main/ServiceList.aspx http://developer.51cto.com/art/200908/147125.htm 这里记录了几个常 ...

  5. OC基础 NSData

    OC基础 NSData 1.NSString转NSData //NSString转NSData NSString *string = @"abcd12345"; NSData *d ...

  6. java下io文件切割合并功能加配置文件

    package cn.stat.p1.file; import java.io.File; import java.io.FileInputStream; import java.io.FileNot ...

  7. WinForm(C#)自定义控件之——RoundButton(圆形按钮)

    最近需要做一个圆形的按钮,去CodeProject找了一下,发现有现成的可用,但不能完全满足我的需求.因此自己试着利用WinForm中的自定义组件功能,制作一个圆形按钮.圆形按钮小制作即将开始之前,先 ...

  8. [Mugeda HTML5技术教程之11]Mugeda API简介

    一.API 概述 Mugeda API 提供了一个简单的,结构化的方法来实时动态管理Mugeda内容.它提供了一下方法: •访问Mugeda内容中的对象. •获取和设置对象属性,如位置.旋转.比例.不 ...

  9. js href的用法

    关于js window.location.href location.href parent.location.href top.location.href 的用法 "window.loca ...

  10. Android-4

    显式Intent 隐式Intent Intent过滤器相关选项 通过浏览器链接启动本地Activity