Advertisement
justhrun

hrefclick2.hateemel

Oct 22nd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.28 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html><head><title>Bla bla</title>
  3. <script type='text/javascript' src='jquery-1.9.1.min.js'></script>
  4. <script type='text/javascript'>
  5. $(document).ready(function() {
  6.     var clickCount = 0;
  7.     $('#hyperlink').on('click', function(e) {
  8.         e.preventDefault();
  9.         $('#hyperlink').hide();
  10.         $('#listbox').show();
  11.     });
  12.     $('#listbox').on('click', function() {
  13.         clickCount++;
  14.         if(clickCount<2) return;
  15.         $('#href').attr('href', $('#blabla option:selected').val());
  16.         $('#href').text($('#blabla option:selected').text());
  17.         $('#listbox').hide();
  18.         $('#hyperlink').show();
  19.         clickCount = 0;
  20.     });
  21.     $('#letsgo').on('click', function() {
  22.         window.location.replace( $('#href').attr('href') );
  23.     });
  24. });
  25. </script></head>
  26. <body><br><br><br><br><br><br>
  27. <div align=center>
  28. <span id='hyperlink'><a id='href' href='http://www.kaskus.co.id'>KusKas</a></span>
  29. <span id='listbox' style='display:none;'>
  30. <select id='blabla'>
  31. <option value='http://www.kaskus.co.id'>KusKas</option>
  32. <option value='http://www.yahoo.com'>Yahuu</option>
  33. <option value='http://www.google.com'>Gugel</option>
  34. <option value='http://www.whitehouse.gov'>Gedung Putih</option>
  35. <option value='http://www.laporpresiden.id'>Lapor Jokowi</option>
  36. </select></span>
  37. <button id='letsgo'>go</button>
  38. </div></body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement