BillyBoB Posted April 11, 2008 Share Posted April 11, 2008 Hi, I have been working on this project for around a week now and I need to be able to search a string and see if it has an image in it. I have no idea where to start so any help will be greatly appreciated. Thanks in Advance, Cean Fritz Link to comment https://forums.phpfreaks.com/topic/100696-javascript-tag-dectection/ Share on other sites More sharing options...
roopurt18 Posted April 11, 2008 Share Posted April 11, 2008 Can you be more specific? Link to comment https://forums.phpfreaks.com/topic/100696-javascript-tag-dectection/#findComment-515003 Share on other sites More sharing options...
BillyBoB Posted April 11, 2008 Author Share Posted April 11, 2008 Sure. Like the string is "<b><img src="blah" alt="bah" /></b>" I want to find if it has the <img tag and then get the height of it. Link to comment https://forums.phpfreaks.com/topic/100696-javascript-tag-dectection/#findComment-515007 Share on other sites More sharing options...
roopurt18 Posted April 11, 2008 Share Posted April 11, 2008 I suppose you could search for the string <img within your string. // Not tested var aString = "this contains an image <img src='myimg' /> in it"; if( aString.search( "<img" ) != -1 ){ alert("has image"); } I have a feeling that's not going to give you what you want. Are you trying to find a specific image within the page? Link to comment https://forums.phpfreaks.com/topic/100696-javascript-tag-dectection/#findComment-515117 Share on other sites More sharing options...
ess14 Posted April 14, 2008 Share Posted April 14, 2008 perhaps a regular expression would help, try look that up Link to comment https://forums.phpfreaks.com/topic/100696-javascript-tag-dectection/#findComment-516474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.