Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating html tags with javascript

    Hi,

    I wanna make a form that receives:

    textbox URL And textbox Anchor

    and result will be two anchors one <a href, and one phpBB

    Example:

    Url: www.pushpin.co.il
    Anchor: pushpin

    Results:
    <a href="http://www.pushpin.co.il">pushpin</a>

    [ url = http://www.pushpin.co.il/ ] pushpin[ /url ]

    Help?

  • #2
    New Coder
    Join Date
    Jun 2011
    Location
    Algeirs,Algeria
    Posts
    43
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Here is the code:
    Code:
    <form>
      Url:<input type="text" id="url" /><br/>
      Anchor:<input type="text" id="anchor" /><br/>
      <input type="button" value="Generate codes" onclick="displayResult()"  />
      <input type="button" value="Reset" onclick="document.getElementById('result').innerHTML=''" />
      <div id="result"></div>
    </form>
    <script type="text/javascript">function displayResult(){
    var url = document.getElementById("url");
    var anchor = document.getElementById("anchor");
    document.getElementById("result").innerHTML = "<a href='"+url.value+"'>"+anchor.value+"</a>" + "<br/>" + "[url="+url.value+"]"+anchor.value+"[/url&#93;";}</script>
    Last edited by Hamza7; 07-17-2011 at 03:52 PM. Reason: phpBB code conflict.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •