Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <textarea id='cont'></textarea>

	<p><input type="button" value="找不好的数字" onclick="t1();"></p>
	<p><input type="button" value="有没有数字" onclick="t2();"></p>
	<p><input type="button" value="有没有大写字母" onclick="t3();"></p>
	<p><input type="button" value="是否全为数字" onclick="t4();"></p>
              
            
!

CSS

              
                		textarea{
			width: 400px;
			height: 200px; 
		}
              
            
!

JS

              
                function t1(){
  var cont = document.getElementById('cont');
  var cv = cont.value;
  var reg = /[347]/;// 匹配347任意一个字符的集合[abcd] 匹配abdc任意一个
  alert(reg.test(cv));
}
function t2(){
  var cont = document.getElementById('cont');
  var cv = cont.value;
  //var reg = /[0123456789]/;
  //var reg = /[0-9]/;// 匹配有没有数字
  var reg = /\d/;// \d 表示[0-9]
  alert(reg.test(cv));
}
function t3(){
  var cont = document.getElementById('cont');
  var cv = cont.value;
  var reg = /[A-Z]/;// 匹配有没有数字
  alert(reg.test(cv));
}
function t4(){
  var cont = document.getElementById('cont');
  var cv = cont.value;
  var reg = /[^0-9]/;// 匹配非数字 0-9之外的字符  对于网上发布手机号之类的很有用 比如1300 把00换成OO 就没法认出
  if(reg.test(cv)){
    alert('有非数字存在');
  }else{
    alert('全是数字');
  }
}
              
            
!
999px

Console