Foros del Web » Programando para Internet » Javascript »

ayuda con BBcode de flash (video)

Estas en el tema de ayuda con BBcode de flash (video) en el foro de Javascript en Foros del Web. Hola amigos de FDW, no se si esto ira aca, si no, me disculpan. el caso es que tengo una web en la cual existe ...
  #1 (permalink)  
Antiguo 03/12/2009, 13:28
 
Fecha de Ingreso: junio-2009
Mensajes: 27
Antigüedad: 14 años, 10 meses
Puntos: 0
Exclamación ayuda con BBcode de flash (video)

Hola amigos de FDW,

no se si esto ira aca, si no, me disculpan.
el caso es que tengo una web en la cual existe el intercambio de mensajes; lo que quiero es que tambien, aparte de links e imagenes, se pueda intercambiar videos en flash, como los de youtube. Es posible hacer eso?

yo no entiendo nada de JS y el codigo que tengo fue scrip que me pasaron:

Código javascript:
Ver original
  1. function addSmiley(smileystring) {
  2.     var textarea = document.getElementById('post');
  3.     if (textarea) {
  4.         textarea.value += smileystring + ' ';
  5.         textarea.focus();
  6.     }
  7.     return true;
  8. }
  9. function removeDefault(defaulttext, formitem) {
  10.     if (defaulttext == formitem.value) {
  11.         formitem.value = '';
  12.     }
  13.     return true;
  14. }
  15. function setBackDefault(defaulttext, formitem) {
  16.     if (formitem.value == '') {
  17.         formitem.value = defaulttext;
  18.     }
  19.     return true;
  20. }
  21. var BBCode = function() {
  22.     window.undefined = window.undefined;
  23.     this.initDone = false;
  24. }
  25. BBCode.prototype.init = function(t) {
  26.     if(this.initDone) return false;
  27.     if(t == undefined) return false;
  28.     this._target = t ? document.getElementById(t) : t;
  29.     this.initDone = true;
  30.     return true;
  31. }
  32. BBCode.prototype.noForm = function() {
  33.     return this._target == undefined;
  34. }
  35. // insertcode is used for bold, italic, underline and quote and just
  36. // wraps the tags around a selection or prompts the user for some
  37. // text to apply the tag to
  38. BBCode.prototype.insertCode = function(tag, desc, endtag) {
  39.     if(this.noForm()) return false;
  40.     var isDesc = (desc == undefined || desc == '') ? false : true;
  41.     // our textfield
  42.     var textarea = this._target;
  43.     // our open tag
  44.     var open = '['+tag+']';
  45.     var close = '[/'+((endtag == undefined) ? tag : endtag)+']';
  46.     if (!textarea.setSelectionRange) {
  47.         var selected = document.selection.createRange().text;
  48.         if (selected.length<=0) {
  49.             // no text was selected so prompt the user for some text
  50.             textarea.value += open+((isDesc) ? prompt("Por favor, introduzca el texto que desea "+desc, "")+close : '');
  51.         } else {
  52.             // put the code around the selected text
  53.             document.selection.createRange().text = open+selected+((isDesc) ? close : '');
  54.         }
  55.     } else {
  56.         // the text before the selection
  57.         var pretext = textarea.value.substring(0, textarea.selectionStart);
  58.         // the selected text with tags before and after
  59.         var codetext = open+textarea.value.substring(textarea.selectionStart, textarea.selectionEnd)+((isDesc) ? close : '');
  60.         // the text after the selection
  61.         var posttext = textarea.value.substring(textarea.selectionEnd, textarea.value.length);
  62.         // check if there was a selection
  63.         if (codetext == open+close) {
  64.             //prompt the user
  65.             codetext = open+((isDesc) ? prompt("Por favor, introduzca el texto que desea "+desc, "")+close : '');
  66.         }
  67.         // update the text field
  68.         textarea.value = pretext+codetext+posttext;
  69.     }
  70.     // set the focus on the text field
  71.     textarea.focus();
  72. }
  73. // inserts an image by prompting the user for the url
  74. BBCode.prototype.insertImage = function (html) {
  75.     if(this.noForm()) return false;
  76.     var src = prompt('Por favor, introduzca la dirección URL', 'ht tp://'); this.insertCode('img='+src);
  77. }
  78. // inserts a link by prompting the user for a url
  79. BBCode.prototype.insertLink = function (ht ml) {
  80.     if(this.noForm()) return false;
  81.     this.insertCode('url='+prompt("Por favor, introduzca la dirección URL", "ht tp://"), 'as text of the link', 'url')
  82. }
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:29.