显示标签为“javascript”的博文。显示所有博文
显示标签为“javascript”的博文。显示所有博文

2009年4月28日星期二

正则表达式验证邮箱地址

定义以下模式为有效的:
  1. john@hotmail.com
  2. john.doe@somewhere.com
  3. John Doe<john.doe@somewhere.com>
javascript的正则表达式为
var reEmail=/^(?:\w+\.?)*\w+@(?:\w+\.?)*\w+$/;

2009年4月23日星期四

Javascript方式打开一个浏览器

var newWindow=window.open(url,'txtPopup','height=768,location=0,menubar=0,personalbar=0,scrollbars=1,status=0,toolbar=0,width=1024,resizable=0');
newWindow.focus();

javascript 刷新页面的方式:
  1. history.go(0)
  2. location.reload()
  3. location=location
  4. location.assign(location)
  5. document.execCommand('Refresh')
  6. window.navigate(location)
  7. location.replace(location)
  8. document.URL=location.href