Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,892 members, 7,828,153 topics. Date: Wednesday, 15 May 2024 at 03:31 AM

Code On Button To Echo Tag, Help! - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Code On Button To Echo Tag, Help! (754 Views)

Please Help, How Do I Place Adsense Code On Wordpress / Add Facebook Like/share Button To Your Blog/website / How To Add Social Media Sharing Button To Blogger Blog (2) (3) (4)

(1) (Reply) (Go Down)

Code On Button To Echo Tag, Help! by Joit(m): 3:40pm On Oct 31, 2008
Nairalanders, does anyone know the code to insert/echo tags in a textarea by just clicking specific buttons. E.g To echo <b></b> in a text area if I click Bold button.
Re: Code On Button To Echo Tag, Help! by DualCore1: 9:42pm On Oct 31, 2008
i can't really say what u want but here is what i just coded up, hope this works for u.
Save the whole of this in a html file (e.g mytags.html) and run it


<HTML>
<HEAD>
<script language="JavaScript" type="text/javascript">
//created by Sawyerr Ken www.pctalknigeria.com
// Helpline messages, dis r the messages tht wld show in ya textbox

b_help = "Bold text: text (alt+b)";
i_help = "Italic text: text (alt+i)";
u_help = "Underline text: <u>text</u>";
w_help = "Insert URL: http://url or URL text (alt+w)";

// Shows the help messages in the helpline window, shay u grab this part
function helpline(help) {

document.post.helpbox.value = eval(help + "_help"wink;

}
</script>

</HEAD>
<BODY>
<center>
<form action="" method="post" name="post" id="post">
<table border=0>
<tr>
<td height="20"><input type="button" class="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onClick="helpline('b')">
<INPUT class=button onClick="helpline('w')" style="WIDTH: 40px; TEXT-DECORATION: underline" accessKey=w type=button value=URL name=addbbcode16>
<input class=button onClick="helpline('i')" style="WIDTH: 30px; FONT-STYLE: italic" accesskey=i type=button value=" i " name=addbbcode2>
<INPUT class=button onClick="helpline('u')" style="WIDTH: 30px; TEXT-DECORATION: underline" accessKey=u type=button value=" u " name=addbbcode4></td>
</tr>
<tr>
<td height="20">
<INPUT
name=helpbox
value="Click on each button, script by Dual Core aka SawyerrKen for nland" size="80"></td>

</tr>
</table>
</form>
</center>
</BODY>
</HTML>
Re: Code On Button To Echo Tag, Help! by DualCore1: 9:51pm On Oct 31, 2008
oops, double post, sorry. lol
Re: Code On Button To Echo Tag, Help! by Joit(m): 10:15am On Nov 03, 2008
Hello Dual Core,

Thank you for the reply.

I am glad to tell you that the code works out well but each button message replaces the previous message. Can't there be a way by which each click will add to the previous button click message instead of replacing it, outright. E.g If I click Bold button in nairaland compose area, instead of it to replace the former text it will (code)add to it.

I need something like the nairaland compose area button function.

I expect your reply. Thanks
Re: Code On Button To Echo Tag, Help! by DualCore1: 10:58am On Nov 03, 2008
i'll be on in it in about half an hour, got a bug to kill.

(1) (Reply)

Become A Website Traffic Consultant / Pls Help Me Review My New Forum / Life After Marriage Through Nigerian Online Dating

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.