Well, it's the following, I was trying to make a custom download block for the users of my blog to download and everything else
Itwasworkingperfectly,thejavascriptfunctionsthatIimplementedhadnoproblem,butwhenIwasputtingonemoredownloadblockinthepost,ithitthatbizarrething:
Itkindofbuggedme,probablybecausethesamedownloadblockcannotoccupyonespace,butIwantedtoorganizethemfromtoptobottomandnotsidebyside,here'smycode,it'salittlebitthickerbutrelativelyshort:
html
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0""http://ww.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>downloads-script</title>
<link rel="stylesheet" type="text/css" href="css/doc.css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script><scripttype="text/javascript" src="js/scriptdownloadform.js"></script>
</head>
<body>
<div class="caixa"><!--caixa e o bloco em si-->
<img id="tumb" src="https://lh6.googleusercontent.com/0JbjEfvTl5IAEPDxekpqOj7aMq_OHu51KAT7gMup6IAObcb3b5v6fqrCmn8bTsTFWDktB7xofnuYPCA=w1366-h589"></img><divid="texto">
<p>Titulo</p>
<p>Epsodio ???</p>
<p>formato:mkv</p>
<p>tamanho:300mb</p>
</div>
</div>
<a href="#" id="down" name="post" onmouseover="setoption('http://www.google.com.br','http://www.wikipedia.com.br',0)">Baixar</a><!--botao de download junto com os parametros da funcao set-->
<div id="op1">
<img src="https://lh5.googleusercontent.com/ZwdgvGW5o7Kv8JS_ILeMti20el26Ab8wGzkUa7OmHyM1xswkjH2FT7Up8PmVtjmVM17_HEkmBy3-a9I=w1366-h589"style="margin-top:0px;width=70px;height:70px;"></img>
</div>
<div id="op2">
<img src="http://1.bp.blogspot.com/-oLI12AT3nHU/Vcu4HYBF5iI/AAAAAAAACis/BhPT5_Ce6Cg/s1600/uptobox-logo.png"style="margin-top:10px;width=50px;height:50px;"></img>
</div>
</body>
css
.caixa {//design da caixa de download
display:inline-block;
background-color:#FFCC00;
border:2px solid #000;
float:left;
width:410px;
height:120px;
border-radius:10px;
position:absolute;
}
#op1 {//design das opçoes
margin-top:110px;
display:inline-block;
float:left;
margin-left:25px;
background-color:#FFCC00;
border:2px solid #000;
width:154px;
height:54px;
border-radius:10px;
}
#op2 {
margin-top:110px;
display:inline-block;
float:left;
margin-left:25px;
background-color:#6600FF;
border:2px solid #000;
width:154px;
height:54px;
border-radius:10px;
}
#texto {
display:inline-block;
float:left;
font-style:Arial bold 2px;
font-size:10px;
font-family:"Comic Sans MS",cursive,sans-serif;
margin-left:10px;
}
#tumb {//design da tumbnail
display:inline-block;
float:left;
width:180px;
height:100px;
border:2px solid #000;
border-radius:10px;
margin-left:2px;
margin-top:2px;
}
#down {//design do botao de download
display:inline-block;
float:left;
position:absolute;
border-radius:10px;
background-color:#000;
width:410px;
height:20px;
font-style:Arial bold 2px;
font-size:15px;
text-align:center;
text-decoration:none;
color:#FFF;
font-family:"Comic Sans MS",cursive,sans-serif;
margin-top:110px;
margin-left:0px;
}
javascript
var op1,op2;
var flag = 0;
function setoption(link1,link2,i){//seta links de download
var x = document.getElementsByName("post")[i];
op1 = link1;//armazena dois links em duas variaveis distintas
op2 = link2;
if(flag==0){//seta o atributo href no botao de download
x.setAttribute('href',op1);
}else{
x.setAttribute('href',op2);
}
}
window.onload = function() {
var btnop1 = document.getElementById("op1");
var btnop2 = document.getElementById("op2");
btnop1.onclick = function(){//funcao que troca a opcao de download assim que selecionada
this.style.backgroundColor = "#ffcc00";
document.getElementById("op2").style.backgroundColor = "#6600FF"
flag = 0;
}
btnop2.onclick = function(){
this.style.backgroundColor = "#ffcc00";
document.getElementById("op1").style.backgroundColor = "#FF3333";
flag = 1;
}
}
I would appreciate anyone who could help me to solve this problem, I think it's because of the display: inline-block the reason this is happening, but I have my doubts: S
PS: I just solved one of the problems of the code, there was a problem in the javascript function when inserting more than two links in the download blocks, but I already solved this by adding a tag name to be able to pick up several download buttons (getElementsByName ), and I added one more parameter for it to receive an index / key (hence the algorithm would not need to fetch the elements on the page), but I still can not solve this block bug problem