Ubb Parser
Ik ben al een tijdje verder gegaan met mijn cms systeem ,, het ging goed tot ik aan kwam bij de ubb codes erin te zetten :S..
Ik heb als een soort box boven mijn textarea dit staan..
<link href="BBCode/add_bbcode1.js" type="text/javascript">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p dir="ltr" align="left">
<span class="gen">
<span class="genmed">
<span lang="ar-sy"> </span>
<img border="0" src="BBCode/images/justify.gif" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" style="border-style: outset; border-width: 1" alt="justify">
<img border="0" src="BBCode/images/right.gif" name="right" type="image" onClick="BBCright()" onMouseOver="helpline('right')" style="border-style: outset; border-width: 1" alt="right">
<img border="0" src="BBCode/images/center.gif" name="center" type="image" onClick="BBCcenter()" onMouseOver="helpline('center')" style="border-style: outset; border-width: 1" alt="center">
<img border="0" src="BBCode/images/left.gif" name="left" type="image" onClick="BBCleft()" onMouseOver="helpline('left')" style="border-style: outset; border-width: 1" alt="left">
<img border="0" src="BBCode/images/bold.gif" name="bold" type="image" onClick="BBCbold()" onMouseOver="helpline('b')" style="border-style: outset; border-width: 1" alt="bold">
<img border="0" src="BBCode/images/italic.gif" name="italic" type="image" onClick="BBCitalic()" onMouseOver="helpline('i')" style="border-style: outset; border-width: 1" alt="italic">
<img border="0" src="BBCode/images/under.gif" name="under" type="image" onClick="BBCunder()" onMouseOver="helpline('u')" style="border-style: outset; border-width: 1" alt="under line">
<img border="0" src="BBCode/images/fade.gif" name="fade" type="image" onClick="BBCfade()" onMouseOver="helpline('fade')" style="border-style: outset; border-width: 1" alt="fade">
<img border="0" src="BBCode/images/grad.gif" name="grad" type="image" onClick="BBCgrad()" onMouseOver="helpline('grad')" style="border-style: outset; border-width: 1" alt="gradient">
<img border="0" src="BBCode/images/rtl.gif" name="dirrtl" type="image" onClick="BBCdir('rtl')" onMouseOver="helpline('rtl')" style="border-style: outset; border-width: 1" alt="Right to Left">
<img border="0" src="BBCode/images/ltr.gif" name="dirltr" type="image" onClick="BBCdir('ltr')" onMouseOver="helpline('ltr')" style="border-style: outset; border-width: 1" alt="Left to Right">
<img border="0" src="BBCode/images/marqd.gif" name="marqd" type="image" onClick="BBCmarqd()" onMouseOver="helpline('marqd')" style="border-style: outset; border-width: 1" alt="Marque to down">
<img border="0" src="BBCode/images/marqu.gif" name="marqu" type="image" onClick="BBCmarqu()" onMouseOver="helpline('marqu')" style="border-style: outset; border-width: 1" alt="Marque to up">
<img border="0" src="BBCode/images/marql.gif" name="marql" type="image" onClick="BBCmarql()" onMouseOver="helpline('marql')" style="border-style: outset; border-width: 1" alt="Marque to left">
<img border="0" src="BBCode/images/marqr.gif" name="marqr" type="image" onClick="BBCmarqr()" onMouseOver="helpline('marqr')" style="border-style: outset; border-width: 1" alt="Marque to right">
</span></span>
</td>
</tr>
<tr>
<td dir="rtl">
<p align="right" dir="rtl" style="margin-top: 0; margin-bottom: 0">
<span style="font-size: 5pt"> </span>
<p align="left" dir="ltr" style="margin-top: 0; margin-bottom: 0">
<span class="gen">
<span class="genmed">
<img border="0" src="BBCode/images/code.gif" name="code" type="image" onClick="BBCcode()" onMouseOver="helpline('code')" style="border-style: outset; border-width: 1" alt="Code">
<img border="0" src="BBCode/images/quote.gif" name="quote" type="image" onClick="BBCquote()" onMouseOver="helpline('quote')" style="border-style: outset; border-width: 1" alt="Quote">
<img border="0" src="BBCode/images/url.gif" name="url" type="image" onClick="BBCurl()" onMouseOver="helpline('url')" style="border-style: outset; border-width: 1" alt="URL">
<img border="0" src="BBCode/images/email.gif" name="email" type="image" onClick="BBCmail()" onMouseOver="helpline('mail')" style="border-style: outset; border-width: 1" alt="Email">
<img border="0" src="BBCode/images/web.gif" name="web" type="image" onClick="BBCweb()" onMouseOver="helpline('web')" style="border-style: outset; border-width: 1" alt="Wep Page">
<img border="0" src="BBCode/images/img.gif" name="img" type="image" onClick="BBCimg()" onMouseOver="helpline('img')" style="border-style: outset; border-width: 1" alt="Image">
<img border="0" src="BBCode/images/flash.gif" name="flash" type="image" onClick="BBCflash()" onMouseOver="helpline('flash')" style="border-style: outset; border-width: 1" alt="Flash">
<img border="0" src="BBCode/images/video.gif" name="video" type="image" onClick="BBCvideo()" onMouseOver="helpline('video')" style="border-style: outset; border-width: 1" alt="Video">
<img border="0" src="BBCode/images/sound.gif" name="stream" type="image" onClick="BBCstream()" onMouseOver="helpline('stream')" style="border-style: outset; border-width: 1" alt="Stream">
<img border="0" src="BBCode/images/ram.gif" name="ram" type="image" onClick="BBCram()" onMouseOver="helpline('ram')" style="border-style: outset; border-width: 1" alt="Real Media">
<img border="0" src="BBCode/images/hr.gif" name="hr" type="image" onClick="BBChr()" onMouseOver="helpline('hr')" style="border-style: outset; border-width: 1" alt="H-Line">
<img border="0" src="BBCode/images/plain.gif" name="plain" type="image" onClick="BBCplain()" onMouseOver="helpline('plain')" style="border-style: outset; border-width: 1" alt="Remove BBcode">
</span>
</td>
</tr>
</table>
Dit ziet er goed uit.. verder heb ik dan nog de javascript pagina..
Dit is een klein stukje
function BBCunder() {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (theSelection != '') {
document.selection.createRange().text = "" + theSelection + "[/ U]";
// kheb hier effe spaties tussen gedaan anders doet hij het neit op het forum hier
document.post.message.focus();
return;
}
}
if (Underline == 0) {
ToAdd = "";
document.post.under.src = "bbcode_box/images/under1.gif";
Underline = 1;
} else {
ToAdd = "[ /U]";
document.post.under.src = "bbcode_box/images/under.gif";
Underline = 0;
}
PostWrite(ToAdd);
}
function BBCurl() {
var FoundErrors = '';
var enterURL = prompt("Enter the URL", "http://");
var enterTITLE = prompt("Enter the page name", "Web Page Name");
if (!enterURL) {
FoundErrors += "You didn't write the URL";
}
if (!enterTITLE) {
FoundErrors += "You didn't write the page name";
}
if (FoundErrors) {
alert("Error :"+FoundErrors);
return;
}
var ToAdd = ""+enterTITLE+"[ /url]";
document.post.message.value+=ToAdd;
document.post.message.focus();
}
Hier in staat volgens mij als ik het goed begrijp dat wat geselecteerd is dat daar de tekens bij moeten verschijnen.. maar nu heb ik het zo geupload en op de pagina aangeroepen..
en ik zet wat in me textarea die text heet.. en dan selecteer ik het en wil ik het underlinend maken,, dan doet hij gewoon niet .. zou iemand mij kunnen vertellen hoe dat komt ?
Gewijzigd op 06/11/2004 22:57:00 door Niels
Er zijn nog geen reacties op dit bericht.