daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest May 16th, 2018 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hyperLink.Attributes.Add("onclick", "javascript:void(viewer.show(" + picNumberlink + "))");
  2.    
  3. <a id="piclink_1" class="picLinks">...</a>
  4. <a id="picLink_2" class="picLinks">...</a>
  5.  
  6. $('a.picLinks').click(function() {
  7.     //split at the '_' and take the second offset
  8.     var picNumber = $(this).attr('id').split('_')[1];
  9.     viewer.show(picNumber);
  10. });
  11.    
  12. var functionIWantToCall = function(){
  13.     var wrappedLink = $(this);
  14.     //some serious action
  15. }
  16.  
  17. //this should be called on document ready
  18. $("#myLinkId").click(functionIWantToCall);
  19.    
  20. var functionIWantToCall = function(event){
  21.     event.preventDefault(); //this one is important
  22.     var link = $(this).attr('href');
  23.     //some serious action
  24. }
  25.    
  26. <a href="..." id="piclink-242" class="view foo-242"><img src="..."/></a>
  27.    
  28. $(function() {
  29.   // using the id attribute:
  30.   $('.view').click(function() {
  31.     viewer.show(+/-(d+)/.exec(this.id)[1]);
  32.   });
  33.  
  34.   // or using the class attribute:
  35.   $('.view').click(function() {
  36.     viewer.show(+/(^|s)foo-(d+)(s|$)/.exec(this.className)[2]);
  37.   });
  38. }}
  39.    
  40. $(document).ready(function()
  41. {
  42.  
  43. $('#LinkID').click(function() {
  44.     viewer.show($(this).attr('picNumber'));
  45. });
  46.  
  47. });
  48.    
  49. <%= Html.ActionLink("Index", new { id = "LINKID", picNumber = 1 }) %>
RAW Paste Data
Top