侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130558 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

某夺宝岛js竞拍代码

2023-12-13 星期三 / 0 评论 / 0 点赞 / 15 阅读 / 2026 字

##第一版function my_bid(username, max_price){var now_username = $($('.auctioninfo tr:first td')[0]).htm

##第一版function my_bid(username, max_price){var now_username = $($('.auctioninfo tr:first td')[0]).html();var price_span = $('.auctioninfo tr:first td')[1];var price = $(price_span).children('span').html();var now_price = parseInt(price) + Math.ceil(Math.random() * 5);if (now_username != username && now_price <= max_price){$('input[class="text quantity-text"]').val(now_price);$('#buy-btn').click();}}setInterval("my_bid('fxhover', 2400)", 100);

##改进版function my_bid(id, username, max_price){$.getJSON('http://auction.jd.com/json/paimai/bid_records?t=1426817263311&dealId='+ id +'&pageNo=1&pageSize=1', function(data){var price = data.datas[0].price;var now_username = data.datas[0].userNickName;var now_price = parseInt(price) + Math.ceil(Math.random() * 10);if (now_username != username){if (now_price <= max_price){$('input[class="text quantity-text"]').val(now_price);$('#buy-btn').click();} else{alert('超过最大预算,停止竞标!');}}});}var id = document.location.href.split('/').pop();setInterval("my_bid(" + id + ", 'fxhover', 300)", 1);

##再次改进版

function my_bid(id, username, max_price){var timestamp = new Date().getTime();$.getJSON('http://auction.jd.com/json/paimai/bid_records?t=' + timestamp + '&dealId='+ id +'&pageNo=1&pageSize=1', function(data){	var price = data.datas[0].price;	var now_username = data.datas[0].userNickName;    var now_price = parseInt(price) + Math.ceil(Math.random() * 10);    if (now_username != username){    	if (now_price <= max_price){			var bid_url = 'http://auction.jd.com/json/paimai/bid?t=' + timestamp + '&dealId=' + id + '&price=' + now_price;	        $.getJSON(bid_url);    	} else{    		alert('超过最大预算,停止竞标!');    	}    } });}var id = document.location.href.split('/').pop();setInterval("my_bid(" + id + ", 'fxhover', 300)", 10);

广告 广告

评论区