Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
User will enter H::Click Here=http://ddgd.com::H this text in textbox.
On button click event, this text has to appear in alert box as Click Here as hyperlink and it should be binded with the link as value. On clicking the hyperlink, it should redirect to the given link.

Thanks.

What I have tried:



<title>
Title












function viewMe() {
var message = document.getElementById('mytext').value;
var pos = message.search('=');
var name = message.substring(3, pos);
var url = message.substring(pos+1, message.length - 3);
alert(name.link(url));
Posted
Updated 14-May-18 1:53am

1 solution

You do not want to use an alert() for this. It's text is always plain text.

    You have to basoc options:
  1. Create your own box (a <div>) which can contain a link (hidden/visible).
  2. Use a confirm() box and base upon the return, go to the link location or don't.

Free additional hint: use location.assign() to go to a specific link location if you use the confirm() route.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900