html5 - HTML concatenating text input with link -
i've got following code:
<form> comments: <input type="text" name="scomments"><br> </form> <a href='http://translate.google.com/#en/nl/' + scomments target="_blank">translate comment , verify it</a>
i trying add text entered in "scomments" text input google translate link , open google translate in new tab. @ moment not able reference text entered tle link.
how can concatenate these values?
p.s.: that's first html code know that's basic question.
thanks in advance,
you need javascript - here's fiddle: http://jsfiddle.net/qgs5w/
basically, need add following in head
section of page:
function clickyclick() { url = 'http://translate.google.com/#en/nl/' + document.getelementbyid("comment").value window.open(url, '_blank'); }
and perhaps, simplicity, change link button:
<form>comments: <input type="text" name="comments" id="comment"> <br> </form> <button onclick="clickyclick()">translate , verify</button>
a bare-bones complete page might this:
<html> <head> <script type='text/javascript'> function clickyclick() { url = 'http://translate.google.com/#en/nl/' + document.getelementbyid("comment").value window.open(url, '_blank'); } </script> </head> <body> <form>comments: <input type="text" name="comments" id="comment"> </form> <br> <button onclick="clickyclick()">translate , verify</button> </body>
Comments
Post a Comment