我用CSS设计的吨可以使用吗?或者我必须替换这些按钮吗?您只需更新它们链接到的位置。href=“#我的链接”将改为“download.php?file=myfile”。谢谢@Aaron Brewer。让我看看你给我的链接。非常感谢。虽然我对PHP并没有什么
我用CSS设计的吨可以使用吗?或者我必须替换这些按钮吗?您只需更新它们链接到的位置。href=“#我的链接”将改为“download.php?file=myfile”。谢谢@Aaron Brewer。让我看看你给我的链接。非常感谢。虽然我对PHP并没有什么,php,html,asp-classic,Php,Html,Asp Classic,我用CSS设计的吨可以使用吗?或者我必须替换这些按钮吗?您只需更新它们链接到的位置。href=“#我的链接”将改为“download.php?file=myfile”。谢谢@Aaron Brewer。让我看看你给我的链接。非常感谢。虽然我对PHP并没有什么想法,但我肯定会尝试一下。我想我从你的台词中得到了一点启示“如果你想做这样的事情,那么一个非常简单的解决方案就是给每个下载按钮一个唯一的ID;让下载计数器作为一个简单div中的数字”!让我试着从头开始。再次非常感谢。非常感谢:))很抱歉在您吃饭
我用CSS设计的吨可以使用吗?或者我必须替换这些按钮吗?您只需更新它们链接到的位置。href=“#我的链接”将改为“download.php?file=myfile”。谢谢@Aaron Brewer。让我看看你给我的链接。非常感谢。虽然我对PHP并没有什么想法,但我肯定会尝试一下。我想我从你的台词中得到了一点启示“如果你想做这样的事情,那么一个非常简单的解决方案就是给每个下载按钮一个唯一的ID;让下载计数器作为一个简单div中的数字”!让我试着从头开始。再次非常感谢。非常感谢:))很抱歉在您吃饭时打扰了您:(如果需要的话,我可能会详细介绍答案,因为答案不太清楚;但正如我所说的,PHP中的mysql函数有一些非常好的教程和文档!考虑到这一点,实际上下载计数器不必是div,jQuery也可以编写任何元素!(这是很多可能性!)我觉得这比担心HTML代码中有内联PHP要好。不过,我肯定会选择jQuery和PHP解决方案,它应该很容易装配!而且,如果你掌握了它,它会打开很多门……晚餐也不太好!;)如果您进一步阐述关于jQuery的观点,我将不胜感激。我已经介绍了jQuery代码的第一部分,以演示如何在组(即类)中的每个元素上循环,然后为该元素创建.post()请求;从PHP脚本返回值。:)不幸的是,我所做的每一次编辑似乎都让它听起来更加复杂和混乱!我又编辑了一遍,我能理解你的感受。我第一次看到jQuery(我对Javascript非常了解)时,我记得我在想“这个不断出现的美元符号到底是什么?!”-但一旦你习惯了它,它就会非常强大和简单。我仍然认为你最好的选择是做这样的事情;如果只为满足和技能你可以使用一次又一次!另外,使用stackoverflow,您永远不会出错;)
<div class="button button1">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">7.54 MB .RAR</p>
</div>
<div class="button button2">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">7.8 MB .RAR</p>
</div>
<div class="button button3">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">7.05 MB .RAR</p>
</div>
<div class="button button4">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">3.8 MB .RAR</p>
</div>
<div class="button button5">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">7.5 MB .RAR</p>
</div>
<div class="button button6">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">8 MB .RAR</p>
</div>
.button {
width: 115px;
}
.button1 {
position:absolute;
left:430px;
top:410px;
}
.button2 {
position:absolute;
left:632px;
top:410px;
}
.button3 {
position:absolute;
left:833px;
top:410px;
}
.button4 {
position:absolute;
left:430px;
top:636px;
}
.button5 {
position:absolute;
left:632px;
top:636px;
}
.button6 {
position:absolute;
left:833px;
top:636px;
}
.button a {
display: block;
height: 28px;
width: 115px;
/*TYPE*/
color: white;
font: bold 11px/28px Helvetica, Verdana, sans-serif;
text-decoration: none;
text-align: center;
text-transform: uppercase;
/*GRADIENT*/
background: #00b7ea; /* Old browsers */
background: -moz-linear-gradient(top, #00b7ea 0%, #009ec3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* IE10+ */
background: linear-gradient(top, #00b7ea 0%,#009ec3 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */
}
.button a, p {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
-moz-box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}
.button p {
background: #222;
display: block;
height: 25px;
width: 105px;
margin: -27px 0 0 5px;
/*TYPE*/
text-align: center;
font: bold 10px/28px Helvetica, Verdana, sans-serif;
color: #ffffff;
/*POSITION*/
position: absolute;
z-index: -1;
/*TRANSITION*/
-webkit-transition: margin 0.4s ease;
-moz-transition: margin 0.4s ease;
-o-transition: margin 0.4s ease;
-ms-transition: margin 0.4s ease;
transition: margin 0.4s ease;
}
/*HOVER*/
.button:hover .bottom {
margin: -4px 0 0 5px;
}
.button:hover .top {
margin: -50px 0 0 5px;
line-height: 22px;
}
/*ACTIVE*/
.button a:active {
background: #00b7ea; /* Old browsers */
background: -moz-linear-gradient(top, #00b7ea 36%, #009ec3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(36%,#00b7ea), color-stop(100%,#009ec3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* IE10+ */
background: linear-gradient(top, #00b7ea 36%,#009ec3 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */
}
.button:active .bottom {
margin: -14px 0 0 5px;
}
.button:active .top {
margin: -30px 0 0 5px;
}
<div class="button button1">
<a href="#my link">Download</a>
<p class="top">Click to begin</p>
<p class="bottom">7.54 MB .RAR</p>
</div>
$(document).ready(function(){
/* [[PART 1]]: loop through every element in the .button class*/
$(".button").each(function (e) {
/* get it's ID (which is equal to the download id stored in the db */
var id = e.target.id;
/* Post the download id to ranking.php; then echo the returned value to an
** element with the id of 'count<num>'; where num is the download id. */
$.post( 'ranking.php', { 'id' : id }, function(data){
$('#count' + id).html(data);
});
});
/* Part 2: When button is clicked, post the download data to "ranking.php" */
$('.button').click(function(event){
var id = e.target.id; //get the id of the button
$.post( 'ranking.php', { 'id' : event.target.id, 'download' : 'YES' }, //set 'download'
function(){ $('#count' + id).html(data) }); //echo new value to html
});
});
<?php
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
if(! isset($_POST['id']) {
//die error!
}
/* if $_POST['download'] isn't set, then just get the current download number
and echo it back to the browser */
if(! isset($_POST['download'] ){
$query = sprintf('SELECT * FROM dl_table WHERE id = %d', $_POST['id']);
mysql_query($query);
print mysql_result($query, 0, 'download');
exit; // no need to carry on, our job is done..
}
/* if the script reaches here then $_POST['download'] is set, so you need to log a
** new download */
$query = //generate query to increment the database field
?>