shedokan Posted November 29, 2007 Share Posted November 29, 2007 I want to find if it's like http://images.neopets.com/neoboards/avatars/sb.gif and I get an error says there is no such function match... <script language="javascript" type="text/javascript"> <!-- function showImage(avatarImage){ if(avatarImage.match("\http:\/\/images\.neopets\.com\/neoboards\/avatars\/[a-zA-Z0-9_]+\.gif")){ var avatarImageS=avatarImage.split("."); avatarImageS=avatarImageS[2].split("/"); avatarImage=avatarImageS[3]; } document.getElementById("image").src="http://images.neopets.com/neoboards/avatars/"+avatarImage+".gif"; } //--> </script> <form action="process.php" method="POST"> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td></td> <td align="right"><img id="image" src="" alt=""></td> </tr> <tr> <td>avatarImage:</td> <td><input type="text" name="image" onkeyup="showImage(this.value)" maxlength="70" value="http://images.neopets.com/neoboards/avatars/sb.gif"></td> </tr> </table> </form> thanks. Link to comment https://forums.phpfreaks.com/topic/79430-solved-problem-with-match-function-please-help/ Share on other sites More sharing options...
emehrkay Posted November 29, 2007 Share Posted November 29, 2007 try test Link to comment https://forums.phpfreaks.com/topic/79430-solved-problem-with-match-function-please-help/#findComment-402163 Share on other sites More sharing options...
shedokan Posted November 29, 2007 Author Share Posted November 29, 2007 it says avatarImage.test is not a function. Link to comment https://forums.phpfreaks.com/topic/79430-solved-problem-with-match-function-please-help/#findComment-402171 Share on other sites More sharing options...
shedokan Posted November 29, 2007 Author Share Posted November 29, 2007 yay, here's what fixed it: var regExp = new RegExp("^(http:\/\/images\.neopets\.com\/neoboards\/avatars\/[a-zA-Z0-9_]+\.gif)"); if(regExp.test(avatarImage)){ Link to comment https://forums.phpfreaks.com/topic/79430-solved-problem-with-match-function-please-help/#findComment-402190 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.