COSC 231, FALL 2012, Programming Project #5

Distributed 10/29     Due: 11/14/2012 11/26/2012

Anchorize HTML source code

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:

You can assume the HTML code that is supplied to the first buffer is correct. Especially, you can assume there are no partially specified anchors (e.g., there will be no text where there is an opening <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.

Deliverables

Grade based on