您的位置:首页 > Web前端

前端常用知识

2017-12-21 18:04 246 查看
1、输入框中的值为默认不可改变

<input class="form-control" name="urlType" id="urlType" value="角色一" disabled

                       style="width:250px"/>

2、输入框有灰色提示输入,可输入

<input class="form-control" name="urlDescription" id="urlDescription" placeholder="分析测试过程"

                       style="width:250px"/>

3、window.open("/admin/addCache.do")浏览器打开另外一个窗口进行/admin/addCache.do这个URL访问

4、询问弹出窗口,点击确定后访问URL:reWarmCache.json

function reWarmCache() {

    if (confirm("确认刷新缓存?")) {

        $.ajax({

            url: "reWarmCache.json",// 跳转到 action

            success: function (data) {

                alert(data.message);

            },

            error: function () {

                alert("异常")

            }

        });

    }

}

5、

onclick函数动态传参

(1)参数为数值类型时:

string 123

 

(2)参数为字符串类型时:

 打印出 string abc

(3)传两个及以上的参数时:

 打印出 abcda xza

 

(4)参数为数组时:

 打印出  string abc,ddd,gg

6、输入框为只读,禁止编辑

<input class="form-control" type="text" readonly style="color:#000000">

7、 按Enter键进行查询

<input style="width:560px" type="text" class="form-control" id="paTestInput" placeholder="输入关键字">

对上面的输入框,按enter后,进行analysisProcessButtonclick()操作。

$('input#paTestInput').keypress(function (e) {

        if (e.which == 13) {

            analysisProcessButtonclick();

            return false;

        }

    });

8、重新加载页面

location.reload();

9、当前页面打开URL页面

window.location.href = url;

拓展:

parent.location.href="/url" 在父页面打开新页面
top.location.href="/url" 在顶层页面打开新页面

10、文字水平居中:text-align:center

      文字垂直居中:line-height:100px;

11、点击超链接要打开新的窗口只需加上  target="view_window",如果在原来窗口打开去掉target即可

例如<a href="www.suning.com" target="view_window">www.suning.com</a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: