JS get content in the picture address regular expression
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>js get the picture address regular expression in content </title>
<script >
function Check ()
{
var content =document.form1.body.value;
if (""!= content)
{
var Patt = '/http://.*? (jpg|png|gif)/'; Affirm the regular
if (Content.match (Patt))
{
Alert (Content.match (Patt));
}
Else
{
Alert (' No picture address ');
}
}
}
</script>
<body>
<form id= "Form1" Name= "Form1" method= "Post" action= "" >
<label></label>
<label>
<textarea name= "Body" cols= "rows=" 5 "></textarea>
</label>
<input type= "button" Name= "Www.111cn.net" value= "Submit" onclick= "check ();" />
</form>
</body>
Original works, reprinted annotated source Www.111cn.net