FSYCS #1: Tiny ContentOf() JavaScript function

Completed Posted May 14, 2012 Paid on delivery
Completed Paid on delivery

[[[ EASY work for vWorker NEWBIE!! ]]] I need a tiny JavaScript function called ContentOf() which get passed an id parameter, then returns the content that's in the span with that corresponding id. In addition, the following must be handled correctly so that they appear as expected when the content is actually used: 1. double-quotes, 2. single-quotes, 3. line-breaks, 4. angle-brackets, 5. ampersands.

This will be used to supplement existing JavaScript and Flash code which enables an end-user to easily copy arbitrary text from a web page. The current code requires the text in question to be passed to a JavaScript function; this will be replaced by simply passing the id of the span whose contents represent the text.

## Deliverables

Right now, an HTML file can have calls like this:

<script type="text/javascript">

ShowLMCButton("Title for Foo");

</script>

Elsewhere in the file, there will be spans like this:

<h6 id="title-foo2">Title for Foo</h6>

I want the ShowLMCButton() calls to be replaced with:

<script type="text/javascript">

LMClickToCopy("title-foo2");

</script>

From casual experimenting, it appears that double-quotes, single-quotes, and line-breaks need to be escaped (with a single back-slash), and that angle-brackets and ampersands do not, but it will be your responsibility to handle all of these correctly so that the end product works as expected. Please advise if you see that I forgot a particular special case.

The attached zip package contains three files:

**[url removed, login to view]** demonstrates the desired click-to-copy functionality, both as it works now ("BEFORE"), as well as how it should work once you are done ("AFTER").

**[url removed, login to view]** contains the JavaScript functions: LMClickToCopy(), which calls ContentOf() (the function you will write), and then ShowLMCButton().

**[url removed, login to view]** is the Flash that actually performs the copying to the end-user's clipboard. This file should not be modified.

Please let me know if you have any questions; I'm happy to help! Thanks!

CSS JavaScript PHP Software Architecture Software Testing Web Hosting Website Management Website Testing

Project ID: #2741254

About the project

6 proposals Remote project Active May 14, 2012

Awarded to:

nikhiljasani

See private message.

$7 USD in 3 days
(15 Reviews)
3.8

6 freelancers are bidding on average $22 for this job

blirding

See private message.

$17 USD in 3 days
(76 Reviews)
5.0
ashok100

See private message.

$10 USD in 3 days
(20 Reviews)
4.2
cenavw

See private message.

$30.6 USD in 3 days
(0 Reviews)
0.0
beeswig

See private message.

$10 USD in 3 days
(0 Reviews)
0.0
neolitecons

See private message.

$60.35 USD in 3 days
(0 Reviews)
0.0