如何在href链接点击时使用jquery在标签上显示消息? [英] How to display message on label using jquery on href link click?

查看:66
本文介绍了如何在href链接点击时使用jquery在标签上显示消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正在编写此代码以便在href链接点击图像显示但我需要根据href链接的不同文本。

我的代码是: -



< script type =text / javascript> 

var theInt = null;
var $ crosslink,$ navthumb;
var curclicked = 0;

theInterval = function(cur){
clearInterval(theInt);

if(typeof cur!='undefined')
curclicked = cur;

$ crosslink.removeClass(active-thumb);
$ navthumb.eq(curclicked).parent()。addClass(active-thumb);
$(。stripNav ul li a)。eq(curclicked).trigger('click');

theInt = setInterval(function(){
$ crosslink.removeClass(active-thumb);
$ navthumb.eq(curclicked).parent()。addClass( active-thumb);
$(。stripNav ul li a)。eq(curclicked).trigger('click');
curclicked ++;
if(6 == curclicked )
curclicked = 0;

},200000);
};

$(function(){

$(#main-photo-slider)。codaSlider();

$ navthumb = $ (.nav-thumb);
$ crosslink = $(。cross-link);
$ navthumb
.click(function(){
var $ this = $(this);
theInterval($ this.parent()。attr('href')。slice(1) - 1);

返回false;

});

theInterval();
});
< / script>

< div class =slider-wrap>

< div id =main-photo-sliderclass =csw>
< div class =panelContainer>

< div class =paneltitle =Panel 1>
< div class =wrapper>
< div class =box-image>
< div class =inner-imagestyle =margin-removed30px;>
< asp:图片ID =uploadImagerunat =serverWidth =823Height =450style =margin:50px 0 200px 0; position:relative; z-index:0; border :无;/>
< asp:图片ID =bg1runat =serverwidth =890ImageUrl =images / bgeventimage.pngborderStyle =无CssClass =floatLeftheight =530style =margin :-680px 0 0 -30px; />

< / div>



< div>

< div>

< / div>
< img src =images / bgeventimage34.pngwidth =890height =510alt =style =margin:30px 0 0 -890px; position:absolute; />

< / div>

< / div>

< / div>
< asp:TextBox ID =Template1TxtTorunat =serverCssClass =sample-text-01placeholder =To ...>
< asp:TextBox ID =Template1TxtFromrunat =serverCssClass =sample-text-02placeholder =from ...>

< / div>

< div class =paneltitle =Panel 2>
< div class =wrapper>
< div class =box-image>
< div class =inner-imagestyle =margin-removed30px;>
< asp:图片ID =Image1runat =serverWidth =823Height =450style =margin:50px 0 200px 0; position:relative; z-index:0; border :无;/>
< asp:Image ID =Image2runat =serverwidth =890ImageUrl =images / bgeventimage.pngborderStyle = None CssClass =floatLeftheight =530style =margin :-680px 0 0 -30px; />

< / div>



< div>
< div>

< / div>
< img src =images / bgeventimage35.pngwidth =890height =510alt =style =margin:30px 0 0 -890px; position:absolute; />

< / div>

<% - < img src =images / bgeventimage33.pngwidth =890height =510alt =scotch eggstyle =margin:0 0 0 0 ;
class =floatLeft/> - %>



< / div>

< / div>
< asp:TextBox ID =TextBox3runat =serverCssClass =sample-text-03placeholder =To ...>
< asp:TextBox ID =TextBox4runat =serverCssClass =sample-text-04placeholder =from ...>
< / div>
< / div>
< / div>
< div id =movers-row>
< div>
< a href =#1class =cross-link>
< img src =images / thumbimage.jpgwidth =150height =100class =nav-thumbalt =temp-thumb/>
< / a>< / div>
< div>< a href =#2class =cross-link>< img src =images / thumbimage2.jpgwidth =150height =100class = nav-thumbalt =temp-thumb/>< / a>
< / div>
< / div>
< asp:Label ID =lblTempolateTextInformationrunat =serverText =>





我想要根据第一个十字板和第二个模板点击lblTempolateTextInformation显示文本两个信息都不同。

如何从jquery中获取。



请帮帮我。



预付结转



Ankit Agarwal

网站开发者

解决方案

交联,


navthumb;
var curclicked = 0;

theInterval = function(cur){
clearInterval(theInt);

if(typeof cur!='undefined')
curclicked = cur;


crosslink.removeClass(active-thumb);

Hello,

I am writing this code for image display on href link click but i need a different text according to href link.
My code is:-

<script type="text/javascript">

	    var theInt = null;
	    var $crosslink, $navthumb;
	    var curclicked = 0;

	    theInterval = function (cur) {
	        clearInterval(theInt);

	        if (typeof cur != 'undefined')
	            curclicked = cur;

	        $crosslink.removeClass("active-thumb");
	        $navthumb.eq(curclicked).parent().addClass("active-thumb");
	        $(".stripNav ul li a").eq(curclicked).trigger('click');

	        theInt = setInterval(function () {
	            $crosslink.removeClass("active-thumb");
	            $navthumb.eq(curclicked).parent().addClass("active-thumb");
	            $(".stripNav ul li a").eq(curclicked).trigger('click');
	            curclicked++;
	            if (6 == curclicked)
	                curclicked = 0;

	        }, 200000);
	    };

	    $(function () {

	        $("#main-photo-slider").codaSlider();

	        $navthumb = $(".nav-thumb");
	        $crosslink = $(".cross-link");
	        $navthumb
			.click(function () {
			    var $this = $(this);
			    theInterval($this.parent().attr('href').slice(1) - 1);

			    return false;

			});

	        theInterval();
	    });
	</script>

<div class="slider-wrap">

		<div id="main-photo-slider" class="csw">
			<div class="panelContainer">
           
				<div class="panel" title="Panel 1">
					<div class="wrapper">
                  <div class="box-image">
                                                            <div class="inner-image" style="margin-removed30px;"> 
                                                             <asp:Image ID="uploadImage" runat="server" Width="823" Height="450" style="margin:50px 0 200px 0; position:relative; z-index:0; border:none;"/>
                                                             <asp:Image ID="bg1" runat="server" width="890" ImageUrl="images/bgeventimage.png" borderStyle=None CssClass="floatLeft" height="530" style="margin: -680px 0 0 -30px;" />
                                                           
                                                            </div>
                                                            
                                                            

                                                            <div>
                                                           
                                                             <div>
                                                           
                                                           </div>
                                                            <img src="images/bgeventimage34.png" width="890" height="510" alt="" style="margin:30px 0 0 -890px; position:absolute;" />
                                                             
                                                        </div>
 
                                                    </div>
                                                     
					</div>
                                                            <asp:TextBox ID="Template1TxtTo" runat="server" CssClass="sample-text-01" placeholder="To...">
                                                            <asp:TextBox ID="Template1TxtFrom" runat="server" CssClass="sample-text-02" placeholder="from...">
                                                            
				</div>
				
                <div class="panel" title="Panel 2">
					<div class="wrapper">
                  <div class="box-image">
                                                            <div class="inner-image" style="margin-removed30px;"> 
                                                             <asp:Image ID="Image1" runat="server" Width="823" Height="450" style="margin:50px 0 200px 0; position:relative; z-index:0; border:none;"/>
                                                             <asp:Image ID="Image2" runat="server" width="890" ImageUrl="images/bgeventimage.png" borderStyle=None CssClass="floatLeft" height="530" style="margin: -680px 0 0 -30px;" />
                                                           
                                                            </div>
                                                            
                                                            

                                                            <div>
                                                             <div>

                                                           </div>
                                                            <img src="images/bgeventimage35.png" width="890" height="510" alt="" style="margin:30px 0 0 -890px; position:absolute;" />
                                                             
                                                        </div>

                                                        <%--<img src="images/bgeventimage33.png" width="890" height="510" alt="scotch egg" style="margin: 0 0 0 0;"
                                                            class="floatLeft" />--%>


                                                        
                                                    </div>
                                                     
					</div>
                                                            <asp:TextBox ID="TextBox3" runat="server" CssClass="sample-text-03" placeholder="To...">
                                                            <asp:TextBox ID="TextBox4" runat="server" CssClass="sample-text-04" placeholder="from...">
				</div>
</div>
		</div>
<div id="movers-row">
        	<div>
            <a href="#1" class="cross-link">
            <img src="images/thumbimage.jpg" width="150" height="100" class="nav-thumb" alt="temp-thumb" />
           </a></div>
			<div><a href="#2" class="cross-link"><img src="images/thumbimage2.jpg" width="150" height="100" class="nav-thumb" alt="temp-thumb" /></a>
            </div>
</div>
<asp:Label ID="lblTempolateTextInformation" runat="server" Text="">



I want to display text on "lblTempolateTextInformation" according to first tenplate and second template click both information are different.
How it can be possible from jquery.

Please help me.

Thanks in Advance

Ankit Agarwal
Website Developer

解决方案

crosslink,


navthumb; var curclicked = 0; theInterval = function (cur) { clearInterval(theInt); if (typeof cur != 'undefined') curclicked = cur;


crosslink.removeClass("active-thumb");


这篇关于如何在href链接点击时使用jquery在标签上显示消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆