Using HTML and Javascript, in a text buffer, replace URLs that do not have links with links.
Create a page with two text buffers, one convert
button, and
informational labels and instructions. The buffers should be fairly large (at least
30 lines long) and labelled as to their different purposes.
The user is instructed to paste html file source code to the first buffer. (The HTML source code can be assumed to be correct.)
After the user clicks the "convert" button, the source code should be placed in the second
buffer. Any URL that does not have an <a>
tag should have the anchor tag added.
Obviously, you will also need to add the </a>
.
Do not add an anchor to an already anchored URL!
Here are some things your code must be able to handle:
<a>
but no closing </a>
.
For detectable URLs, you can use any previously supplied RegEx (see your book,
w3schools.com
or other).
Regular expressions must be used to detect the problematic URLs.