Results 1 to 6 of 6

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User bombov's Avatar
    Join Date: Jan:2007
    Location:
    Posts: 260

    Javascript or Jquery event handler

    :

    Code:
    function show_project_details(service_id, project_id,object)
    {
        $('#secondGallery_'+project_id+' ul li img').each(function()
        {
            $(this).css('border','none');
        });
        object.setAttribute('style', "border:3px solid #000");
    //Another code
    
        object.setAttribute('onmouseup', "close_project_details("+service_id+", "+project_id+", this);");
    
    function close_project_details(service_id, project_id, object)
    {
    object.setAttribute('onmouseup', "show_project_details("+service_id+", "+project_id+", this);");
    object.setAttribute('style', "border: none");
    }
    , .

    // :
    $(this).attr('onmouseup','function');

    Code:
        
    $('#secondGallery_'+project_id+' ul li img').each(function()
    {
    //     .
            $(this).css('border','none');
    //        .       $(this).attr('onmouseup','"show_project_details("+service_id+", "+project_id+", this);");')
        });
    .:
    :
    -show_projects_details - ajax .
    -close_project_details - .

    :
    show_projects_detail close_project_detail show_projects_detail.

    :
    close_project_details , , close_project_details show_projects_details.

    :
    $(this).attr('onmouseup','"show_project_ details("+service_id+", "+project_id+", this);");')

    , .

  2. #2
    Registered User 's Avatar
    Join Date: Feb:2006
    Location:
    Posts: 653
    web , ?

    - .

  3. #3
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    ( ) event-handlers .attr() . .bind() .mouseup() .
    , !

  4. #4
    Registered User bombov's Avatar
    Join Date: Jan:2007
    Location:
    Posts: 260
    .

    html Kod :

    <img onmouseup="show_project_details(1, 1,this);"/>
    <img onmouseup="show_project_details(1, 2,this);"/>
    <img onmouseup="show_project_details(1, 3,this);"/>

    img[0] html :

    <img onmouseup="close_project_details(1, 1,this);"/>
    <img onmouseup="show_project_details(1, 2,this);"/>
    <img onmouseup="show_project_details(1, 3,this);"/>

    img[1] html :

    <img onmouseup="close_project_details(1, 1,this);"/>
    <img onmouseup="close_project_details(1, 2,this);"/>
    <img onmouseup="show_project_details(1, 3,this);"/>

    am img[0] close_project_details , show_project_details(argument 1,argument 2,this)

    Quote Originally Posted by View Post
    web , ?

    - .
    , .
    Last edited by bombov; 24th June 2010 at 00:25.

  5. #5
    Registered User
    Join Date: Feb:2006
    Location: Plovdiv
    Posts: 392
    :
    Code:
    <img onmouseup="change_project_details_state(1, 1,this);" data-state="open_close" />

  6. #6
    Registered User JACK's Avatar
    Join Date: Mar:2004
    Location:
    Posts: 651
    - unbind live.

    , test.html :
    HTML Code:
    <html>
    <body>
    
    	<img src="http://www.w3schools.com/images/compatible_ie.gif" id="img0"/><br>
    	<img src="http://www.w3schools.com/images/compatible_ie.gif" id="img1"/><br>
    	<img src="http://www.w3schools.com/images/compatible_ie.gif" id="img2"/><br><br>
    
    	Project 0 <span id="details0"></span><br>
    	Project 1 <span id="details1"></span><br>
    	Project 2 <span id="details2"></span>
    
      	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
      	<script src="test.js"></script>
    
    </body>
    </html>
    test.js:
    Code:
    $(function(){
    	
    	$('img').click(function() { manageProjectDetails.call(this); });
    	
    	function manageProjectDetails(hide){		
    		id = this.id.match(/\d+/);
    		span = $($('#details' + id)[0]);;
    		
    		if(hide)
    			span.hide();	
    		else
    			span.show().text('AJAX call returned details for project ' + id);
    		
    		$(this).unbind('click').click(function() { manageProjectDetails.call(this, ! hide); });			
    	}
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |