Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Oct 2017
    Posts
    1
    Member #
    57558

    Making website, that you can paste couple of words and select specific words ? [help]

    Hi all,
    I'm new to this forum but i decided to design some ''simple'' website not sure if i should use HTML or Java script.

    All i want my website to do is :
    You paste list of words for example ''red, blue, yellow, orange , green'' click a button and it highlights from the list for example blue and yellow.

    And basically thats all, was thinking where to make such thing are there some simple/easy ways to do such website ?

    Thanks for helping !

  2.  

  3. #2
    Junior Member SoftLink's Avatar
    Join Date
    Sep 2017
    Location
    Central Florida
    Posts
    24
    Member #
    57480
    Browsers generally have search functionality built in. On a PC if you hold Ctrl & click F you can usually gain access to a search box.
    The resultant text is highlighted for you. Different devices use different techniques.

    To do it manually on a Web page, I'd use JavaScript.
    I'd search for the text using a JavaScript function to find all occurrences of the text.
    I'd write the function to return an array of index numbers.

    Then using JavaScript, I'd wrap each element in a span tag with a css class I'd name highlight.
    css:
    Code:
    .highlight {background-color:#fffddb;)
    html:
    Code:
    <span class='highlight'>Orange</span>
    To remove the highlight I'd write a JavaScript function to strip all the tags (not the text inside them) having the class .highlight.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:33 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com