Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alternative to alert box

    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:

    Code:
    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.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    ...
    var ch=document.getElementById('mess').firstChild;
    ch.data=(!strFound)?'"+str+'" not found!':' ';
    ...
    <input type="text">
    <br>
    <span id="mess">&nbsp;</span>
    ...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you!

    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •