Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Not Working.php</title>
  6. <link rel="stylesheet" href="jquery-ui-1.10.4.custom/css/ui-lightness/jquery-ui-1.10.4.custom.css">
  7. <script src="jquery-ui-1.10.4.custom/js/jquery-1.10.2.js"></script>
  8. <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.js"></script>
  9. </head>
  10. <body>
  11. <script>
  12. function romanize (num) {
  13. return "(" + "roman for " + ")";
  14. }
  15.  
  16. $(document).ready(function(){
  17.  
  18. $(".romanCheck").live("change",function() {
  19. alert("#romanCheck.click has been hit");
  20. var romanValue = "";
  21. var roman = $("#romanCheck").is(':checked');
  22. if ( roman ) {
  23. var itValue = $(this).val();
  24. romanValue="(" + romanize(itValue) +")";
  25. }
  26. $("#romanDisplay").text(romanValue);
  27. });
  28.  
  29. $("span.iterationField input").live("change",function() {
  30. alert("#iteration.change has been hit");
  31. var romanValue = "";
  32. var roman = $("#romanCheck").is(':checked');
  33. if ( roman ) {
  34. var itValue = $(this).val();
  35. romanValue="(" + romanize(itValue) +")";
  36. }
  37. $("#romanDisplay").text(romanValue);
  38. });
  39. });
  40.  
  41. </script>
  42. <form action='EventValidateProcess.php' method='post'>
  43. <?php
  44. $doesShow = 1;
  45. $isRoman = 1;
  46. $iteration - 13;
  47. print "<table>n";
  48. print "<tr>nt<td>Iteration</td>nt";
  49. print "<td><span id='iterationField'><input type='text' name='iteration' value='" . $iteration . "'></span></td>nt";
  50. print "<td><input type='checkbox' name='doesShow' value='1'";
  51. if ($doesShow == 1) {
  52. print " checked";
  53. }
  54. print "> visible | ";
  55.  
  56. print "n<input class='romanCheck' id='romanCheck' type='checkbox' name='isRoman' value='1'";
  57. if ($isRoman == 1) {
  58. print " checked";
  59. }
  60. print "> uses Roman numeralsn";
  61. print "<span id='romanDisplay'>(XX)</span></td>n</tr>n";
  62. ?>
  63. </table>
  64. <button type='submit' name='process' value='update'>Update</button><br/>
  65. </form>
  66. </body>
  67.  
  68. $( elements ).on( events, selector, data, handler );
  69.  
  70. $(document).on("change", "span.iterationField input" ,function() { //code here });
  71. $(document).on("change", ".romanCheck" ,function() { //code here });
  72.  
  73. $(document).ready(function(){
  74. $("input.romanCheck").on("change",function() {
  75. alert("#romanCheck.click has been hit");
  76. var romanValue = "";
  77. var roman = $("#romanCheck").is(':checked');
  78. if ( roman ) {
  79. var itValue = $(this).val();
  80. romanValue="(" + romanize(itValue) +")";
  81. }
  82. $("#romanDisplay").text(romanValue);
  83. });
  84. });
  85.  
  86. $(document).change("input.romanCheck", function() {
  87. var romanValue = "";
  88. var roman = $("#romanCheck").is(':checked');
  89. if ( roman ) {
  90. var itValue = $("#iterationField").val();
  91. romanValue="(" + romanize(itValue) +")";
  92. }
  93. $("#romanDisplay").text(romanValue);
  94. });
  95.  
  96. $(document).change("input.iterationField", function() {
  97. var romanValue = "";
  98. var roman = $("#romanCheck").is(':checked');
  99. if ( roman ) {
  100. var itValue = $("#iterationField").val();
  101. romanValue="(" + romanize(itValue) +")";
  102. }
  103. $("#romanDisplay").text(romanValue);
  104. });
  105.  
  106. print
  107. "<input id='iterationField' type='text' name='iteration' value='";
  108. print $iteration . "'/>";
  109.  
  110. print
  111. "<input id='romanCheck' type='checkbox' name='isRoman' value='1'";
  112. if ($isRoman == 1) {
  113. print " checked";
  114. }
  115. print ">";
  116.  
  117. print "<span id='romanDisplay'>";
  118. if ($isRoman == 1) {
  119. print "(" . $romanIteration . ")";
  120. }
  121. print "</span>";
  122.  
  123. function romanclick(){
  124. //if event fire twice use namespace at 1. and 2. and put $(document).off('namespace') here
  125.  
  126.  
  127. //your code romanclick
  128. $('span.iterationField input').click(function(){
  129. textchange();// call it again
  130.  
  131.  
  132.  
  133. });
  134.  
  135. }
  136.  
  137.  
  138.  
  139. function textchange(){
  140. //if event fire twice use namespace at 1. and 2. and put $(document).off('namespace') here
  141.  
  142.  
  143. //change text code
  144.  
  145. $('.romancheck').click(function(){
  146. romanclick();// call it again
  147.  
  148.  
  149.  
  150. });
  151.  
  152. } ;
  153.  
  154. 1.$(document).on("change", "span.iterationField input" ,function() { //call your function here });
  155. 2.$(document).on("change", ".romanCheck" ,function() { //call your function here });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement