jeudi 18 août 2016

Variable javascript not working

When using buka_halaman('produk','1') then working but when using variable is not working

function rute(){
//window.onhashchange = function(){
  switch(location.hash) {
    case location.hash:
	var abc = location.hash.split('#')[1]; // ex: domain.com/page.html#produk','1
	var def = "'"+abc+"'";
	if (abc!=undefined){
      alert(def);
      buka_halaman(def); //error
	  buka_halaman('produk','1') //working
	  }
    break;
  }
//}
}

Aucun commentaire:

Enregistrer un commentaire