Ir para conteúdo

POWERED BY:

Arquivado

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

Wesley F Souza

Atualizar dados do formulário e TextArea dinamicamente

Recommended Posts

Olá amigos, estou tentando fazer isso como o jQuery mas não está dando certo :/ já tentei de tudo e não sei o que está errado.

Alguém ai poderia dar uma ajuda?

Segue o script


$(document).ready(function() {
$("#gerarwidget").bind("change keyup", function() {

// Dados
var cat 	= $("select[name=cat]   option:selected").val();
var lin 	= $("select[name=lin] 	option:selected").val();
var img 	= $("select[name=img] 	option:selected").val();

// Dados2
var height  = tamanho;

/* ----- Dimensoes ----- */

   // Width
if(lin == 1 && img == 1) {
	var width  = tamanho;
	var height = tamanho;
}
else if(lin == 1 && img > 1) {
	var width  = (tamanho * img) + (img * 10);
	var height = tamanho;
}
else if(lin > 1 && img == 1) {
	var width  = tamanho;
	var height = (tamanho * lin) + (img * 10);
}
else {
	var width  = (tamanho * img) + (img * 10);
	var height = (tamanho * lin) + (img * 10);
}

/* ----- Dimensões ----- */

// Gera o código do Text Area
$("#codigowidget").text('<iframe frameborder="0" style="background:none;" width="' + width + '" height="' + height + '" src="http://www.site.com/widget.php?&cat=' + cat + '&lin=' + lin + '&img=' + img + '" scrolling="no"></iframe>');

// Gera o preview 
$("#preview").html('<iframe frameborder="0" style="background:none;" width="' + width + '" height="' + height + '" src="http://www.site.com/widget.php?&cat=' + cat + '&lin=' + lin + '&img=' + img + '" scrolling="no"></iframe>');

// Dimensoes Width x Height
$("#dimensoes").html("Dimensões: <b>" + width + "x" + height + "</b>");
   });

$("#gerarwidget").trigger("change");
});

Compartilhar este post


Link para o post
Compartilhar em outros sites

oq aparece no console de erros ?

 

 

Ctrl+Shift+J no Firefox.

http://wbruno.com.br/2011/03/31/como-debugar-javascript-firefox-erros-comuns/

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.