消息关闭
    暂无新消息!
    <script type="text/javascript">

        function vaUrl(){
            var advUrl1=$("input[name='advUrl']").val();
            var strRegex = "^(http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&amp;%\\$#\\=~])*$";
            var re=new RegExp(strRegex);
            if (re.test(advUrl1)!=true){
                $("#attr").text("");
                $("#attr").append("网址格式不正确");
            }else{
                $("#attr").text("");
                $("#attr").append("通过信息验证!");
            }
        }
    </script>

<body>
            <td align="right">
                <label class="Validform_label">
                    <span class="need">*</span>
                    广告目标链接:
                </label>
            </td>
            <td class="value">
                <input id="advUrl" name="advUrl" type="text" style="width: 150px" class="inputxt" onblur="vaUrl()" >
                <span class="Validform_checktip" id="attr" style="color: red" datatype="url"></span>
                <label class="Validform_label" style="display: none;">广告目标链接</label>
            </td>
</body>

6个回答

︿ 3
 $("#attr").append("<p style='background: 要设置的颜色'>网址格式不正确</p>");这个试试
︿ 2
刚看清楚是字体颜色,那就把背景颜色background设置为color:red
︿ 1
<script type="text/javascript">

    function vaUrl() {
        var advUrl1 = $("input[name='advUrl']").val();
        var strRegex = "^(http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&amp;%\\$#\\=~])*$";
        var re = new RegExp(strRegex), pass;
        $('#advUrl').next().html((pass = re.test(advUrl1)) ? '通过信息验证!' : '网址格式不正确!').css('color', pass ? 'green' : 'red');
    }
</script>

<body>
    <td align="right">
        <label class="Validform_label">
            <span class="need">*</span>
            广告目标链接:
        </label>
    </td>
    <td class="value">
        <input id="advUrl" name="advUrl" type="text" style="width: 150px" class="inputxt" onblur="vaUrl()" />
        <span class="Validform_checktip" id="attr" style="color: red" datatype="url"></span>
        <label class="Validform_label" style="display: none;">广告目标链接</label>
    </td>
</body>