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 3 of 3

Thread: Javascript

  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript

    Hey, this is prob extrealy simple but yano....

    I am building news post and i want to have buttons at the side for html tags.

    for example if the user wanted to add a url, they would just click the url button input the address and the whole href tag will apear next to there text in the main inputbox.

    any suggestions?

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    970
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Code:
    <html>
    <head>
    <script>
    hrefIt = (function(){
    	this.args = arguments;
    	return function(el){
    		el.value=args[0] + el.value + args[1];		
    	}
    })("<a href='","'></a>")
    </script>
    </head>
    <body>
    
    <input type=text size="50" onblur="hrefIt(this)"><br>
    type in url then click here
    </body>
    
    </html>
    Last edited by DaveyErwin; 08-30-2010 at 05:51 PM.

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That kinda what i ment...

    Here is a better example; when you post a reply on this forum you have 'smilies' on the right. When you clikc a smily then " or ect" will apear in the text box your writing it. I want to do the same but with html tags.


  •  

    Posting Permissions

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