Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

programador php

substituir conteudo da div

Recommended Posts

galera....preciso substituir o conteudo de uma DIV por vazio com a função getText eu pego o conteudo da divmas não consigo substituir dá esse erro

uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://152.156.51.36/sistema/js/ajax.js :: CreateRequest :: line 229" data: no]

idOptions  = document.getElementById("opcos");		 		 var pega_texto = getText(idOptions);		 var texto = "";		 var texto = texto.replace(pega_texto, "");		 alert(pega_texto);		 alert(texto);		 if(pega_texto != ""){			 idOptions.appendChild(texto); 		}
espero que eu tenha sido claro..abraço

Compartilhar este post


Link para o post
Compartilhar em outros sites

opa valeu pela dica!!!

 

segue como ficou

 

function getText(el) {  var text = "";  if (el != null) {	if (el.childNodes) {	  for (var i = 0; i < el.childNodes.length; i++) {		var childNode = el.childNodes[i];		if (childNode.nodeValue != null) {		  text = text + childNode.nodeValue;		}	  }	}  }  return text;}function replaceText(el, text) {  if (el != null) {	clearText(el);	var newNode = document.createTextNode(text);	el.appendChild(newNode);  }}function clearText(el) {  if (el != "") {	if (el.childNodes) {	  for (var i = 0; i < el.childNodes.length; i++) {		var childNode = el.childNodes[i];		el.removeChild(childNode);	  }	}  }}idOptions  = document.getElementById("opcos");var pega_texto = getText(idOptions);var texto = ""; if(pega_texto != " "){	var texto = replaceText(idOptions, " "); 	var pega_texto = "";	idOptions.innerHTML = ""; }

valeu pela ajuda

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.