javascript - change input box into hyperlink -


i have code google map marker thing. im around couple of days. have code in map_process.php

$mname      = filter_var($_post["name"], filter_sanitize_string); $maddress   = filter_var($_post["address"], filter_sanitize_string); $mtype      = filter_var($_post["type"], filter_sanitize_string);   $results = $mysqli->query("insert markers (name, address, lat, lng, type) values ('$mname','$maddress',$mlat, $mlng, '$mtype')"); if (!$results) {         header('http/1.1 500 error: not create marker!');        exit();  }  $output = '<h1 class="marker-heading">'.$mname.'</h1><p>'.$maddress.'</p><p>'.$mtype.'</p>'; exit($output); 

}

and want change text inserted in input box clickable link. can me?

i trying this

    <html>  <head>  <title>links</title>  <script type="text/javascript">  function createlink() {    var str = '';    str += '<a href="http://'+document.getelementbyid('tbox').value+'">'+document.getelementbyid('tbox').value+'</a>';    var txt = "<p>";     var tmp = 'http://'+document.getelementbyid('tbox').value;    str += txt.link(tmp);    document.getelementbyid('tlink').innerhtml = str;  }  </script>  </head>  <body>  <input type="text" id="tbox" value="" size="40">  <button onclick="createlink()">create link</button>   <br>  <div id="tlink"></div>   </body>  </html>   

.link method wraps text around anchor tag href specified in argument. here's more succinct implementation:

function createlink() {     var txt = document.getelementbyid('tbox').value;     var href = 'http://' + txt;     var str = txt.link(href);      document.getelementbyid('tlink').innerhtml = str; } 

fiddle


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -