`
woai671
  • 浏览: 29892 次
社区版块
存档分类
最新评论
文章列表
设置或获取对象指定的文件名或路径。 alert(window.location.pathname); 设置或获取整个 URL 为字符串。 alert(window.location.href); 设置或获取与 URL 关联的端口号码。 alert(window.location.port); 设置或获取 URL 的协议部分。 alert(window.location.protocol); 设置或获取 href 属性中在井号“#”后面的分段。 alert(window.location.hash); 设置或获取 location 或 URL 的 hostname 和 port ...
点击按钮跳转到某个页面: <input type="button" value="跳转按钮" onclick="javascrtpt: window.location.href = 'http://www.baidu.com'"/>
各种浏览器对于不同元素常常有不同的表现,为了让各浏览器表现一致,需要判断是否为IE,如果为IE则执行特定的样式设置,例: .linkInput{ width: 259px; height: 22px; width: 255px \9; //后加 "\9"则兼容所有IE版本,IE下执行的样式,其他浏览器忽略 height: 20px \9; }
让背景图片的大小自动适应DIV大小,兼容主流浏览器,包括Firefox、Chrome以及 IE 等: .imgDiv{ width:500px; height:500px; background-image:url('../images/index.jpg'); -moz-background-size: 100% 100%; -o-background-size: 100% 100%; -webkit-background-size: 100% 100%; background-size: 100% 100% ...
登陆页面经常要去文本框获取焦点,可使用如下方法: <script> window.onload = function(){ var oInput = document.getElementById("Loginname"); oInput.focus(); } </script> 或者 <body onload="document.getElementById('Loginname').focus();">
使用网站安全监测,发现“自动目录列表功能”漏洞,该漏洞的含义为:任何人都可以浏览该目录下的所有文件列表。 IIS服务器的解决方案如下: 使用 UI 1.打开 IIS 管理器,然后导航至您要管理的级别。 2.在“功能视图”中,双击“目录浏览”。 3.在“操作”窗格中,如果“目录浏览”功能已禁用而您要启用它,请单击“启用”。 或者,如果“目录浏览”功能已启用而您要禁用它,请单击“禁用”。 命令行 .若要启用或禁用目录浏览,请使用下面的语法: appcmd set config /section:directoryBrowse /enabled:true|false 默认情况下,enabled 属 ...
//非IE浏览器正常显示数目,IE显示数目为0 var LoadImg = document.getElementsByName("ImgDiv"); alert(LoadImg.length); 完善修改后: if (!+[1, ]) //IE { var LoadImg = document.getElementsByTagName('div'); var n=0; for (var i = 0,m=0; i < LoadImg.length; i++) { if (LoadImg[i].name ...

js判断浏览器类型

    博客分类:
  • JS
<script> if(!+[1,]) alert("ie浏览器");   else alert("非ie浏览器"); </script>
1、在你要放置广告的div设定ID,内容可自定义 <div id="banner">读取中……</div> 2、在</body>前面加入以下代码 <div id="to_banner" style="display: none"> <script src='广告脚本' language='javascript'> </script> </div>         3、到页面最下面</html>之后加入以下代码 ...

C# 字符串截取

    博客分类:
  • C#
c#中字符串截取使用的方法 String substring(int beginIndex) String substring(int beginIndex, int endIndex) String.Substring (Int32) //子字符串从指定的字符位置开始。 String.Substring (Int32, Int32) //子字符串从指定的字符位置开始且具有指定的 ...
C# 获取系统当前时间(长格式) 时间格式:2014-05-04 15:41:21 string time = System.DateTime.Now.ToString("G");
C#网页需要记录浏览页面的客户端IP地址,可通过以下方法: 1.在aspx中的 下加入隐藏控件: <asp:HiddenField ID="HiddenIP" runat="server" /> 2.在aspx.cs中加入以下代码: protected void Page_Load(object sender, EventArgs e) { string ip = Request.ServerVariables.Get("Remote_Addr").ToString(); IP.Value = ...
当在页面上设置隐藏控件: asp:HiddenField ID="HiddenIP" runat="server" 在JS中通过$('#XXX').val()获取值有时候会失败, 因为JS执行时,asp控件的ID会改变,会在其ID命名前加上前缀, 所以不能这样直接通过ID获取,这个时候获取的正确方式是: $(':hidden[id$=XXX]').val()

SQL按指定顺序查询

    博客分类:
  • SQL
在有些情况下,我们需要查询结果按指定顺序排列 例如:查询ID为217,21,18,220的用户信息,希望查询结果以ID为217,21,18,220的顺序排列 select id,name from 表名 where id in (217,21,18,220) order by charindex(','+convert(varchar,id)+',',',217,21,18,220,')
使用控件RequiredFieldValidator加上ValidationSummary,验证必填项是否为空,若为空则在消息框中显示错误,实际测试中发现并不弹出消息框。甚至页面会显示“[color=yellow]WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).[/color] ”。 从网上找到修改Web.config文件的解决方案: 将httpRunt ...
Global site tag (gtag.js) - Google Analytics