...

View Full Version : Javascript



astaroth
08-30-2010, 03:24 PM
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?

DaveyErwin
08-30-2010, 06:34 PM
<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>

astaroth
08-31-2010, 02:06 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum