Home > Net >  How do i make the generated link anchor text only?
How do i make the generated link anchor text only?

Time:07-10

I plan on sharing this to a Facebook group I'm in but I want the link that is generated from putting in the information to be text only and not the url. How can I do this?

<style>
a:link, a:visited {
  background-color: #f44336;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: red;
}
</style>
<head>

<script type="text/javascript">
            function generateLink() {
                let link = document.getElementById('link');
                                
                let Group = document.getElementById('GroupID');
                let User  = document.getElementById('UserID');

                                
                let link_string = 'https://m.facebook.com/group/block/?group_id=' 
                                      Group.value 
                                      '&user_id='
                                      User.value;
                link.innerHTML =  '<a href='   encodeURI(link_string)   '>'   encodeURI(link_string)   '</a>';
                                

                               
                               
            }
 
            </script>
      </head>


<body>
Group ID Number: <input type='text' id='GroupID' onkeyup='generateLink();' /> <br>The Group ID Number is the first set of numbers in the url https://www.facebook.com/groups/<mark>Group ID Number</mark>/user/User ID Number<br><br>
User ID Number: <input type='text' id='UserID' onkeyup='generateLink();' /><br> The User ID Number is the second set of numbers in the url https://www.facebook.com/groups/Group ID Number/user/<mark>User ID Number</mark> <br><br>
<span id='link'></span><br><br>





<a href="https://lookup-id.com/" target="_blank">I don't know what the Group or User ID Number is</a> <br><br>



</body>

How do I make the generated link to be a clickable text link only?

CodePudding user response:

I don't really understand your question.

Do you want it to look like pure text but clickable?

Use CSS: color: black and text-decoration: none

CodePudding user response:

 link.innerHTML =  '<a href='   encodeURI(link_string)   '>'   "FaceBook Group"   '</a>';

Write like this

  • Related