javascript小工具

ppylox
·11/25/2020·4 阅读
\n

获取当前日期:

\n\n\n\n
new Date().getFullYear() + "-" +  (new Date().getMonth() + 1< 10? '0' + new Date().getMonth() + 1: new Date().getMonth() + 1 ) + '-' + new Date().getDate()
\n\n\n\n

阻止element form表单默认提交

\n\n\n\n
@submit.native.prevent
\n\n\n\n

Element form表单显示必填样式星星

\n\n\n\n
Label填空格,否则不显示星星
\n\n\n\n

javascript 打开新浏览器窗口

\n\n\n\n
location.href = "javascript:window.open('http://um-selfservice.paic.com.cn/um-selfservice/ss/forget_password_valid_frame.jsp','newwindow', 'height=768,width=1366, top=0, left=0')"\n\n\nwindow.open 是 javaScript 打开新窗口的方bai法,在前面加上 javascript: 是用于du a 标签的超链接调用 js 方法。zhi\nwindow.open 基本语法: window.open(pageURL,name,parameters);具体示例daowindow.open('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')\n\n\nwindow.open("http://www.w3school.com.cn","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400")\n
\n

评论 (0)

暂无评论,来写第一条吧