Results 1 to 3 of 3

Thread: [RESOLVED] Beginner needs simple help

  1. #1
    Join Date
    Sep 2009

    resolved [RESOLVED] Beginner needs simple help

    Hi I am new to javascript and was wondering if someone could help me with a pretty basic idea.

    What I want to create is a list of items, with a button at the top, and when you click the button, you get a prompt, and if you type in an item that is matchable on the list, then that item on the list will be striked out.

    And so you could have a list of 50 items and each time you enter a valid item into the prompt it will cross the corresponding item out on the list.

    So for example if you had a list of girls you wanted to kiss before you die you could make a list of all their names and then as you accomplish each goal you could push the button and type their name in the prompt, and the script would strike their name out on the list.

    Here is a visual example of what I mean:


    Could anyone give me the basic gist of how I would create such a script? Keeping in mind that I am a beginner

  2. #2
    Join Date
    Jun 2004
    Portsmouth UK
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <script type="text/javascript">
    function Strik(obj){
     var p=prompt('Strik')
     while (obj.nodeName!='UL'&&obj.parentNode){
     var lis=obj.getElementsByTagName('LI');
     for (var z0=0;z0<lis.length;z0++){
      if (lis[z0].innerHTML.replace(/\s/g,'')==p){
      <li><input type="button" name="" value="Strik" onclick="Strik(this);"/></li>

    God loves you and will never love you less.

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Sep 2009
    Oh wow you didn't just help you wrote up the code for me!

    Thank you vwphillips, I'm sorry to come in here asking for help with such basic stuff, but I read over a crapload of javascript tutorial first and learned some of what I needed but hit a wall and was looking for someone to send me in the right direction again.

    But you went above and beyond and just did the code for me. I really appreciate it. By the way if you are curious, I am going to use the code for a little personal project I am working on, when I am done it will have about 500 items in non-alphabetical order in 5 different columns and that little tool you gave me will allow me to rapidly and repeatedly mark individual items off the list with ease without needing to manually search through the hundreds of items.

    I will PM the finished product here so you can see what I used your tool to do

    Thank you so much you are a very kind person

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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