Jump to content


dstebo

Member Since 04/06/2005
Offline Last Active 02/04/2013, 08:40
-----

Topics I've Started

Soma Em Javascript Valor Errado

29/03/2013, 10:54

Oi pessoal estou usando javascrip que somar dois cálculos, porem não esta calculando certo,
quando vou somar vamos supor 3,50 + 5,20 ou invés dar 8,70 resultado da 8,00.

O que pode ser?

Print na tela
<?php echo SUB_TITLE_SUB_TOTAL; ?><span id="total_display"><?php echo $currencies->format($cart->show_total()); ?></span><div id="texto_frete"></div><input type="hidden" id="sub_total" value="<?php echo $cart->total; ?>" />

Script que estou usando esse abaixo:
<script type="text/javascript">
function enviaReq(url, tipo) 
{
var postcode = document.getElementById('postcode').value;
var shipping = document.getElementById('shipping_'+tipo).value;
var valor_frete = document.getElementById('valor_'+tipo).value;
var sub_total = document.getElementById('sub_total').value;
var total = (parseFloat(valor_frete) + parseFloat(sub_total)).toFixed(2).replace(".", ",");
document.getElementById("total_display").innerHTML="R$ " + numberFormat(total);
document.getElementById('texto_frete').innerHTML='<br><b>Valor Total: </b>';


function numberFormat(total)
{
	var numero = total.toString();
	var comprimento = numero.length;
	var centena = numero.substr(0, comprimento-3);
	var decimal = numero.substr(comprimento-2);
	var formatado, milhar;
	
	if(comprimento >= 7) {
		milhar = numero.substr(0, comprimento-6);
		centena = numero.substr(comprimento-6, comprimento-3);
		formatado = milhar + '.' + centena + '' + decimal;
	} else {
		formatado = centena + ',' + decimal;
	}
	
	return formatado;
}
</script>

Botão Css Hover Não Funciona Ie8

25/10/2012, 13:08

Botão css hover não funciona ie8

Estou usando um imagem em botão hover quando passado mouse ou clicado aparece outra imagem botão afundado.

Fiz teste Isso funciona bem no Chrome e Firefox, mas o efeito hover não funciona no Internet Explorer 8.

Existe uma maneira de fazer que esse efeito funciona no IE8 também?

Tem solução para ie8, ie9??

Valor Decimal Depois Da Virgula Não Calcula

26/07/2012, 09:21

Estou usando essa função, mais não calcula os centavos exemplo: 24,50 + 12,00 = 36,00
E os valores exemplo 1.230,00 fica assim 1230.00

O que pode estar ocorrendo para não calculo dos centavos, e regra para deixar ponto e virgula.

AONDE PARECE O VALOR
<?php echo SUB_TITLE_SUB_TOTAL; ?></b><span id="total_display"><?php echo $currencies->format($cart->show_total()); ?></span><input type="hidden" id="sub_total" value="<?php echo $cart->total; ?>" />

FUNÇÃO
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
var postcode = document.getElementById('postcode').value;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url+"&postcode="+postcode,true);
  xmlhttp.send(null);
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url+"&postcode="+postcode,true);
  xmlhttp.send();
  }
}
var xmlhttp;
function enviaReq(url, tipo)
{
var postcode = document.getElementById('postcode').value;
var shipping = document.getElementById('shipping_'+tipo).value;
var valor_frete = document.getElementById('valor_'+tipo).value;
var sub_total = document.getElementById('sub_total').value;
var total = (parseFloat(valor_frete) + parseFloat(sub_total)).toFixed(2);
document.getElementById("total_display").innerHTML= "+total;

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url+"&postcode="+postcode+"&shipping="+shipping,true);
  xmlhttp.send(null);
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url+"&postcode="+postcode+"&shipping="+shipping,true);
  xmlhttp.send();
  }
}
function stateChange()
{
if (xmlhttp.readyState==4)
  {
  if (xmlhttp.status==200)
    {
    // process whatever has been sent back here
    document.getElementById('test').innerHTML=xmlhttp.responseText;
    }
  }
} 
</script>

IPB Skin By Virteq