PDA

View Full Version : bbcode maker with browse button


Johny159
12-29-2002, 11:03 AM
it's like this
it's suposed be an input field with a browse button, so i could get a local path to an file example c:\path\to\file\file.doc

and an field where i would enter the link name

example link name

and when i press the make button i would get this




[URL=file://c:/path/to/file/file.doc]link name[\URL]

and if there are any spaces it should be replaced with %20

path to file --- path%20to%20file

brothercake
12-29-2002, 04:33 PM
sounds reasonable. What's your question?

Johny159
12-29-2002, 09:23 PM
how do i make it?? i'm not so good in js, if it's simple to make could someone help me

PauletteB
12-30-2002, 06:02 AM
<script language="JavaScript" type="text/javascript">
function urlConvert() {
document.uform.urlbox.value = document.uform.filebox.value;
document.uform.urlbox.value = "file://" + document.uform.urlbox.value.replace(/\\/g,"/").replace(/\s/g,"%20");
document.uform.newbox.value = "[URL=" + document.uform.urlbox.value + "]" + document.uform.linkbox.value + "[/URL]";
}
</script>

<p><form action="javascript:void(0)" name="uform">
Enter link name...
<input type="text" size="55" name="linkbox"><br>
<input type="file" size="70" name="filebox">
<input type="hidden" name="urlbox"><br>
<input type="text" name="newbox" size="70">
<input type="button" name="cButton"
value="Make url" onClick="urlConvert()"><br>
<input type="reset" value="Clear">
</form></p>

Johny159
12-30-2002, 09:08 AM
hey thanks i don't know how to thank you,
i'm more a designer than i am a "coder" so i sometimes need help with these things :)

again, thanks very much