jquery对象PHP转换,php – 将常规Javascript转换为jQuery

我有一些代码涉及单击按钮,您要么已登录,要么转到下一页,否则您将退出并收到提醒.我从来没有喜欢onClick里面的

HTML,所以我想把它转变为点击id并让jQuery发挥其魔力.

我理解jQuery的click函数,但我不知道如何放入do_bid(“.$val [”id“].”);与其余的Javascript一起使用.如果我没有提供足够的信息或者有官方资源,请告诉我.

Bid

//Some other Javascript above this

function do_bid(aid)

{

var loged_in = "= $_SESSION["BPLowbidAuction_LOGGED_IN"] ?>";

if(loged_in=="")

{

alert('You must log in to bid!');

}

else

{

document.location.href="item.php?id="+aid;

}

}

更新:这是整个Javascript代码.我认为到目前为止没有一个答案是有效的,因为答案不符合我的其余Javascript.我希望这有帮助

$(document).ready(function(){

function calcage(secs, num1, num2) {

s = ((Math.floor(secs/num1))%num2).toString();

if (LeadingZero && s.length < 2)

s = "0" + s;

return "" + s + "";

}

function CountBack() {

for($i=0; $i

echo "myTimeArray[".$i."] = myTimeArray[".$i."] + CountStepper;";

}

for($i=0; $i

echo "secs = myTimeArray[".$i."];";

echo "DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,1000000));";

echo "DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));";

echo "DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));";

echo "DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));";

echo "if(secs < 0){

if(document.getElementById('el_type_".$i."').value == '1'){

document.getElementById('el_".$i."').innerHTML = FinishMessage1;

}else{

document.getElementById('el_".$i."').innerHTML = FinishMessage2;";

echo " }";

echo "}else{";

echo " document.getElementById('el_".$i."').innerHTML = DisplayStr;";

echo "}";

}

?>

if (CountActive) setTimeout("CountBack()", SetTimeOutPeriod);

}

function putspan(backcolor, forecolor, id) {

document.write("");

}

if (typeof(BackColor)=="undefined") BackColor = "white";

if (typeof(ForeColor)=="undefined") ForeColor= "black";

if (typeof(TargetDate)=="undefined") TargetDate = "12/31/2020 5:00 AM";

if (typeof(DisplayFormat)=="undefined") DisplayFormat = "%%D%%d, %%H%%h, %%M%%m, %%S%%s.";

if (typeof(CountActive)=="undefined") CountActive = true;

if (typeof(FinishMessage)=="undefined") FinishMessage = "";

if (typeof(CountStepper)!="number") CountStepper = -1;

if (typeof(LeadingZero)=="undefined") LeadingZero = true;

CountStepper = Math.ceil(CountStepper);

if (CountStepper == 0) CountActive = false;

var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;

var myTimeArray = new Array();

for($i=0; $i

ddiff=document.getElementById('el_sec_'+=$i;?>).value;

myTimeArray[=$i;?>]=Number(ddiff);

} ?>

CountBack();

function do_bid(aid)

{

var loged_in = "= $_SESSION["BPLowbidAuction_LOGGED_IN"] ?>";

if(loged_in=="")

{

alert('You must log in to bid!');

}

else

{

document.location.href="item.php?id="+aid;

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值