本文介绍了如何在asp.net中使用javascript id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的javascript下面:





sj_vm_deal_437这个id使用的是javascript。如何在这个id中使用datalist











below my javascript:


sj_vm_deal_437 this id was using javascript. how to use datalist in this id





<script type="text/javascript">
//<![CDATA[
        if (typeof  Virtuemart !== 'undefined') {
        Virtuemart.addtocart_popup = 1;
        usefancy = "1";
        vmLang = "";
        window.vmSiteurl = "http://demo.smartaddons.com/templates/joomla3/sj-maxshop/";
		var _carts =  jQuery("#sj_vm_deal_437").find('form');
		_carts.each(function(){
		var _cart = jQuery(this),
		_addtocart = _cart.find('input.addtocart-button');
		_addtocart.on('click',function(e) {
			Virtuemart.sendtocart(_cart);
			return false;
			});
		});
		}

jQuery(document).ready(function ($) {

	 $("#sj_vm_deal_437 .addtocart-button input").val('');
	 $("#sj_vm_deal_437 .addtocart-button input").parent().append('<i class="fa fa-gift"></i>');
	 var total_product = '8';
	var owl = $("#sj_vm_deal_437 .owl-carousel");
			var nb_column1 = 4,
			nb_column2 = 2,
			nb_column3 = 2,
			nb_column4 = 1;
			owl.owlCarousel({
                nav: 1,
                dots: false,
                margin: 30,
                loop:  0,
                autoplay: 0,
                autoplayHoverPause: 1,
                autoplayTimeout: 5000,
                autoplaySpeed: 2000,
                mouseDrag: 1,
                touchDrag: 1,
                navRewind: true,
                navText: [ '<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>' ],
                responsive: {
                    0: {
                        items: nb_column4,
                        nav: total_product <= nb_column4 ? false : ((1) ? true: false),
                    },
                    480: {
                        items: nb_column3,
                        nav: total_product <= nb_column3 ? false : ((1) ? true: false),
                    },
                    768: {
                        items: nb_column2,
                        nav: total_product <= nb_column2 ? false : ((1) ? true: false),
                    },
                    1200: {
                        items: nb_column1,
                        nav: total_product <= nb_column1 ? false : ((1) ? true: false),
                    },
                }
            });

	  $("#sj_vm_deal_437 .item .item-rating").each(function(){
		  var item = $(this);
		  var rating = item.attr('data-rating');
		  if(parseFloat(rating) > 4.5){
			   item.find('.item-star').addClass('item-rating-chose');
		  }else{
			  for(var i = 0; i < 5; i++){
				  var a = i + 1;
				  var b = parseFloat(a) + 0.5;
				  var c = parseFloat(a) - 0.5;
				  if((c < parseFloat(rating)  && parseFloat(rating) < b) || b < parseFloat(rating)){
					  item.find('.item-star').eq(i).addClass('item-rating-chose');
				  }
			  }
		  }

	  });
	  	 function mktime(time){
		 var array_time = time.split(' ');
		 var array_year = array_time[0].split('-');
		 var array_minus = array_time[1].split(':');
		  a=new Date()
		  a.setHours(array_minus[0]);
		  a.setSeconds(array_minus[2]);
		  a.setMinutes(array_minus[1]);
		  a.setDate(array_year[2]);
		  a.setYear(array_year[0]);
		  a.setMonth(array_year[1]);
		  return a.getTime();
	}
	var array_time = new Array();
	var time_now = mktime('2015-12-25 04:43:02');
	var i = 0;
	$("#sj_vm_deal_437 .owl-carousel .item").each(function(){
		var mk_time = $(this).find('.item-deals').attr('data-deals');
		if(typeof mk_time != 'undefined'){
		array_time[i] = mktime(mk_time);
		var minutes = 1000 * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var html_day = parseInt((parseInt(array_time[i]) - parseInt(time_now))/days);
		var html_hours =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days)/hours);
		var html_minus = parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
		var html_seconds =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
		$(this).find('.item-deals').html('<div class="sj_deals_cd_day">'+(html_day)+'<p>Days</p></div><div class="sj_deals_cd_day">'+html_hours+'<p>Hours</p></div><div class="sj_deals_cd_day">'+html_minus+'<p>Mins</p></div><div class="sj_deals_cd_day">'+html_seconds+'<p>Secs</p></div>');
		i++;
		}
	});
		var mk_time = $("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.item-deals').attr('data-deals');
		if(typeof mk_time != 'undefined'){
		var mk_time_first_product = mktime(mk_time);
		var minutes = 1000 * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var html_day = parseInt((parseInt(mk_time_first_product) - parseInt(time_now))/days);
		var html_hours =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days)/hours);
		var html_minus = parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
		var html_seconds =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
		$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.item-deals').html('<div class="sj_deals_cd_day">'+(html_day)+'<p>Days</p></div><div class="sj_deals_cd_day">'+html_hours+'<p>Hours</p></div><div class="sj_deals_cd_day">'+html_minus+'<p>Mins</p></div><div class="sj_deals_cd_day">'+html_seconds+'<p>Secs</p></div>');
		}
	setInterval(function(){
		time_now = time_now + 1000;
		var i = 0;
		$("#sj_vm_deal_437 .owl-carousel .item").each(function(){
			var minutes = 1000 * 60;
			var hours = minutes * 60;
			var days = hours * 24;
			var years = days * 365;
			var html_day = parseInt((parseInt(array_time[i]) - parseInt(time_now))/days);
			var html_hours =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days)/hours);
			var html_minus = parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
			var html_seconds =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(0).html(html_day + '<p>Days</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(1).html(html_hours + '<p>Hours</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(2).html(html_minus + '<p>Mins</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(3).html(html_seconds + '<p>Secs</p>');
			i++;
		});
			var minutes = 1000 * 60;
			var hours = minutes * 60;
			var days = hours * 24;
			var years = days * 365;
			var html_day = parseInt((parseInt(mk_time_first_product) - parseInt(time_now))/days);
			var html_hours =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days)/hours);
			var html_minus = parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
			var html_seconds =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(0).html(html_day + '<p>Days</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(1).html(html_hours + '<p>Hours</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(2).html(html_minus + '<p>Mins</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(3).html(html_seconds + '<p>Secs</p>');
	}, 1000);
	  	  setTimeout(function(){
			$('.sj_quickview_handler').html('<i class="fa fa-search"></i>');
	  },1500);

	  $("#sj_vm_deal_437 .sj_percentage_discount_display").each(function(){
		  if($(this).find('a').length > 0){
			  var html = $(this).find('a').html();
			  $(this).html(html);
		  }
	  })
	  });
//]]>
</script>

推荐答案




这篇关于如何在asp.net中使用javascript id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 21:40