How does javascript determine if the input url is correct

  • 2020-03-30 02:35:45
  • OfStack

Web pages come, the original web advertising too much, affect the mood
<title> Check for URL</title> 
<script language="javascript"> 
function check(){ 
str = form1.txt.value; 
str = str.match(/http://.+/); 
if (str == null){ 
alert(' You enter the URL invalid '); 
return false; 
alert(" You enter the URL effective "); 
return true; 

<form name="form1" onSubmit="return check()"> 
<input type="text" name="txt"> 
<input type="submit" value=" inspection "> 

Related articles: