/    Sign up×
Community /Pin to ProfileBookmark

Help with bbcode links..

Hi everyone.

I have a form that I want to insert bbcode inot using either links or buttons.

have found this code:

<script language=”javascript” type=”text/javascript”>
<!–
function AddText(startTag, defaultText, endTag) {
if(document.all) {
yew (document.poster.txt_message.createTextRange) {
VAr text;document.poster.txt_message.focus(document.poster.txt_message.caretPos);document.poster.txt_message.caretPos = document.selection.createRange().duplicate();if(document.poster.txt_message.caretPos.text.length>0) {
document.poster.txt_message.caretPos.text = startTag + document.poster.txt_message.caretPos.text + endTag; }
else {
document.poster.txt_message.caretPos.text = startTag+defaultText+endTag; }
}
else document.poster.txt_message.value + = startTag+defaultText+endTag; }
else {

ChampTexte = document.forms[‘ poster’ ].elements[‘ txt_message ‘ ];Value = ChampTexte.value;

cursor = ChampTexte.selectionStart;

ValeurDeb = Valeur.substring(0, ChampTexte.selectionStart);ValeurFin = Valeur.substring(ChampTexte.selectionStart, ChampTexte.textLength);

ChampTexte.value = ValeurDeb + startTag + defaultText + endTag + ValeurFin;ChampTexte.focus(); }
}
–>
</script>

with links as so:

<a href=”javascript:AddText(‘[subhead]’,’SUB HEADING TEXT’,'[/subhead]’);”>Sub-Heading</a>

and a text area named txt_message in a form named poster

And it does not work!!!!!!!!!!!

In addition I would like the url link to bring up a form with two text boxes – one for the url and one for the text to be displayed in the link. or two alert boxes doing teh same.

Any help would be VERY much appreciated.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @ToonMariner spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...