js indexOf()函数字符查找方法

js indexof()函数字符查找方法
*/

function checkdomain(domain)
{
 if(domain.indexof(".")==-1)
 {
     return -1;
 } 
 return 1;
}

var d ='www.111cn.net';
if( checkdomain( d ) )
{
 alert('有效域名');
}
else
{
 alert('无效域名');
}

时间: 2024-09-03 13:37:54

js indexOf()函数字符查找方法的相关文章

js indexOf() 函数使用方法

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <t

利用lastIndexOf字符查找方法

利用lastindexof字符查找方法 lastindexof 方法返回一个整数值,指出 string 对象内子字符串的开始位置.假如没有找到子字符串,则返回 -1. 假如 startindex 是负数,则 startindex 被当作零.假如它比最大字符位置索引还大,则它被当作最大的可能索引. 从右向左执行查找.否则,该方法和 indexof 相同. 下面的示例说明了 lastindexof 方法的用法 public static int lastindexofany(string str,

java indexOf()简单字符查找实例

java indexof()简单字符查找实例 int indexof(string ch); 就是查找字符/字符串ch在index以后的位置,如果没有找到返回-1;index可以有可以没有,没有时默认为0. eg: string str="liuzheliuxing";        system.out.println((int)'i')                         // i的ascii        system.out.println(str.indexof(

28个JS验证函数收集_表单特效

JS验证函数的调用方法和注意: 1.给表单设置onsubmit="return test()",配合<input type="submit" name="Submit" value="check"> 进行提交. 2.<input type=text onkeydown="test();"> //当鼠标按下直接调用函数验证 3.<input type=text onblur=&q

JS+CSS实现模仿浏览器网页字符查找功能的方法

 这篇文章主要介绍了JS+CSS实现模仿浏览器网页字符查找功能的方法,实例分析了javascript实现查找功能的样式及相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下     本文实例讲述了JS+CSS实现模仿浏览器网页字符查找功能的方法.分享给大家供大家参考.具体实现方法如下:   代码如下: <html> <head> <title>JS+CSS模仿的网页字符查找功能</title> <style type=text/css> BODY

java indexOf() 和lastIndexOf()字符查找实现方法

java indexof() 和lastindexof()字符查找实现方法 class indexofdemo {   public static void main(string args[]) {     string s = "now is the time for all good men " + "to come to the aid of their country.";     system.out.println(s);     system.out

JS+CSS实现模仿浏览器网页字符查找功能的方法_javascript技巧

本文实例讲述了JS+CSS实现模仿浏览器网页字符查找功能的方法.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: <html> <head> <title>JS+CSS模仿的网页字符查找功能</title> <style type=text/css> BODY { FONT-SIZE: 12px; LETTER-SPACING: 1pt; LINE-HEIGHT: 22px; MARGIN-LEFT: 5pt; MARGIN-TOP

PHP使用strstr()函数获取指定字符串后所有字符的方法_php技巧

本文实例讲述了PHP使用strstr()函数获取指定字符串后所有字符的方法.分享给大家供大家参考,具体如下: PHP的strstr()函数可搜索字符串在另一字符串中的第一次出现位置,并返回字符串的剩余部分. strstr()函数定义如下: strstr(string,search,before_search) 参数说明: string 必需.规定被搜索的字符串. search  必需.规定所搜索的字符串. 如果此参数是数字,则搜索匹配此数字对应的 ASCII 值的字符. before_searc

js indexOf split join函数用法

js indexof  split join函数用法 文章为你免费提供js indexof  split join函数用法,重点介绍了indexof与split函数的详细用法与举例说明哦. join var delimitedstring=myarray.join(delimiter); var mylist=new array("jpg","bmp","gif","ico","png"); var por