Small piece of JavaScript code required to sit on an HTML page needed today
- or -
Post a project like this2013
£60(approx. $75)
- Posted:
- Proposals: 3
- Remote
- #2154971
- Awarded
Description
Experience Level: Entry
Estimated project duration: 1 day or less
Small piece of JavaScript code required to sit on an HTML page.
A variable called apple will be passed in the URL to the HTML page with the JavaScript code on it.
The JavaScript will need to 'see' the variable and based on whether it can find the following string in the variable it will use a switch case to send the visitor to another URL, with the original variable code appended to the resulting URL.
The four switch cases and strings to look for are:
Case 1: 45r send to https://www.domain.com/someurl1.html?apple=
Case 2: d4e send to https://www.domain.com/someurl2.html?apple=
Case 3: rg2 send to https://www.domain.com/someurl4.html?apple=
Default case: send to https://www.domain.com/someurl5.html?apple=
Example:
https://www.domain.com/someurl.html?apple=e4rfe45re
would be seen as Switch case 1 by the code and the page would immediately change to https://www.domain.com/someurl1.html?apple= e4rfe45re
NOTE: if none of the three strings are present in the code then default case is enacted and the page changes to
https://www.domain.com/someurl5.html?apple=$apple
The string must be in the order it is in the Switch Cases above, so 5r4 for example would not be recognized as Case 1.
DELIVERABLES:
Fully working JavaScript code with script tags etc that can be placed in an HTML page
A variable called apple will be passed in the URL to the HTML page with the JavaScript code on it.
The JavaScript will need to 'see' the variable and based on whether it can find the following string in the variable it will use a switch case to send the visitor to another URL, with the original variable code appended to the resulting URL.
The four switch cases and strings to look for are:
Case 1: 45r send to https://www.domain.com/someurl1.html?apple=
Case 2: d4e send to https://www.domain.com/someurl2.html?apple=
Case 3: rg2 send to https://www.domain.com/someurl4.html?apple=
Default case: send to https://www.domain.com/someurl5.html?apple=
Example:
https://www.domain.com/someurl.html?apple=e4rfe45re
would be seen as Switch case 1 by the code and the page would immediately change to https://www.domain.com/someurl1.html?apple= e4rfe45re
NOTE: if none of the three strings are present in the code then default case is enacted and the page changes to
https://www.domain.com/someurl5.html?apple=$apple
The string must be in the order it is in the Switch Cases above, so 5r4 for example would not be recognized as Case 1.
DELIVERABLES:
Fully working JavaScript code with script tags etc that can be placed in an HTML page
Sophia C.
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
3 Oct 2018
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies