View Full Version : Alternative to alert box

05-04-2006, 05:53 AM
I have installed a 'Search this page' script which works great. However, I am wondering how I can get rid of the alert box when a search term isn't found. I would prefer to display the 'not found' message on the page itself, below the input box.

This is the code for the alert:

if (!strFound) alert("'"+str+"' not found!")

(Do I need to add the entire script?)

I'm pretty dense when it comes to javascript and I have tried everything I can think of to get this to work, but obviously I have lots more to learn. :(

05-04-2006, 09:39 AM
var ch=document.getElementById('mess').firstChild;
ch.data=(!strFound)?'"+str+'" not found!':' ';
<input type="text">
<span id="mess">&nbsp;</span>

05-05-2006, 05:21 AM
I had to make a couple of minor changes to get that to work, but it works exactly the way I had hoped it would.

Thanks, you're the best! :thumbsup: