www.webdeveloper.com
Results 1 to 3 of 3

Thread: Use JavaScript To Rewrite HTML

  1. #1
    Join Date
    Jun 2008
    Posts
    61

    Use JavaScript To Rewrite HTML

    is there a way that the following may be done:

    1.) Copy HTML

    2.) Paste into text box

    3.) Click "Process" Button

    starting from here...
    -------------------------------------------------------

    4.) Upon hitting the "Process" button, JavaScript proceeds to go thru the text, and replace specific strings as designated by the JavaScript program.

    For example:
    the string "dog" is replaced with the string "<a href="dogs.html">dog</a>"
    the string "cars" is replaced with the string "<a href="cars.html">cars</a>"

    and so on....

    where I presume there would have to be a database, stored as an array, or something somehow, where

    if string is "dog" then replace with "<a href...etc>"
    if string is "cars" then replace with "<a href...etc2>"

    and so on and on for every string you seek to replace, and so there could be hundreds and hundreds.

    At the conclusion of step 4,

    5.) JavaScript outputs the new text into a new text box.

    ---------------------------------------------

    I hope I explained this clearly enough.

    Thank you,
    erik

    (and if anyone also may know of any relevant sources with respect to this, i tryed searching the forums and didn't come up with much.)
    ScrollSeek - one list
    EJMusik - explore the musical wonders
    Engineering Archives - learn engineering

  2. #2
    Join Date
    Jun 2008
    Posts
    61

    or

    or that database, (or array) which specifies all the conditions may be stored directly within the JavaScript program????
    ScrollSeek - one list
    EJMusik - explore the musical wonders
    Engineering Archives - learn engineering

  3. #3
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374

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



Recent Articles