Jump to content

Raktim

Members
  • Content Count

    39
  • Joined

  • Last visited

Everything posted by Raktim

  1. This code gives an error that x[m] is undefined when it calls show(i) but it works fine if I call like show(0). What happens? I already declare x and m then why it gives an error? My code... <html> <head> <style> .myslides{margin: 0px;} </style> </head> <body> <div class="myslides"></div> <div class="myslides"></div> </body> <script> var x = document.getElementsByClassName("myslides"); var i = -1; function show(m) { x[m].style.display = "block"; } function hide(n) { x[n].style.display = "none"; } while(i<x.length) { i = i+1; show(i); setTimeout(hide(i), 3000); if(i==x.length){i = -1;} } </script> </html>
  2. Raktim

    Animated Modal Box

    Thanks for helped me. I need some time to understand the code. Because I am a JS beginner, not JQuery...
  3. Raktim

    Animated Modal Box

    I create a modal box that when the user clicks on the button the modal will appear with animation. When the user clicks on the close button ( located on the right side of the header area ) or anywhere of the screen except modal box it will disappear without animation. I want that the modal will disappear/hide with animation. I create two CSS animation. One is animatetop which I already used when modal will open and another is animatedown which I want to use when modal will disappear. But, I can't understand how to do that? See the code on JSFiddle <html> <head> <style> .background{ display:none; position: fixed; z-index: 1; height: 100%; left: 0; top: 0; width: 100%; padding: 100px; background-color: rgba(0,0,0,0.4); } .modal{ background-color: white; position: relative; border: 1px solid #888; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); animation-name: animatetop; animation-duration: 0.4s; width: 80%; } .header{ width: 100%; padding: 8px 20px; background-color: crimson; color: white; } .footer{ width: 100%; padding: 8px 20px; background-color: lime; color: white; } .middle{ width: 100%; padding: 2px 20px; background-color: white; color: black; } h2{ margin: 0px; } @keyframes animatetop { from {top:-300px; opacity:0} to {top:0; opacity:1} } @keyframes animatedown { from {top:0; opacity:1} to {top:-300px; opacity:0} } span{ float: right; color: white; font-size: 28px; font-weight: bold; cursor: pointer; padding: 2px 5px; } </style> </head> <body> <button onclick="modal()">Open Modal</button> <div class="background" id="MyModal"> <div class="modal" id="modal"> <div class="header"> <span onClick="a()">&times;</span> <h2>Header</h2> </div> <div class="middle"> <h1>Modal</h1><br> <h1>Popup Box</h1> </div> <div class="footer"> <h2>Footer</h2> </div> </div> </div> </body> <script> background = document.getElementById("MyModal"); function modal() { document.getElementById("MyModal").style.display = "block"; } function a() { document.getElementById("MyModal").style.display = "none"; } window.onclick = function (event) { if(event.target == background) { document.getElementById("MyModal").style.display = "none"; } } </script> </html>
  4. Sir, I make two pattern [A-z]{7}\d which can match this string Raktimf8 If I change the position of \d like \d[A-z]{7} then it can match this string 8Raktims How I match this pattern Rakti8ms
  5. I want to make that input take only 2 number at least one lowercase, one uppercase and at least 8 characters except number. I tried this pattern... (?=(.*\d){2})(?=.*[A-z])(?=.*[a-z])[A-z!"#$%&'()*+,-.\/:;<=>?@[\]^_`{|}~]{8,} But it totally fails. Then what should be my correct pattern to do that? I want Like... Abc4k9h2L ->FALSE Abc4k9hL+ ->TRUE Abc4l@s$kl4 ->TRUE
  6. But, those 2 string does not full match. 1 string only charecter 5 is matched and 2nd string only F8 are matched. But I want to do match the complete string. How to modify that?
  7. I also have another question (?=(.*\d){2})(?=.*[A-Z])(?=.*[a-z]) If I use this pattern then I think it takes a total of 4 characters ( 2 number + 1 lowercase + 1 uppercase letter ) to match. Tested Data: Ab45 ->Not Match a4F8-> Not Match What actually happens? What is the meaning of this pattern?
  8. Okay. I already use the following pattern which takes At least two number, one lowercase letter one uppercase letter and at least 8 characters. (?=(.*\d){2})(?=.*[A-z])(?=.*[a-z]).{8,} Means, 4 characters (2 number + 1 lowercase + 1 uppercase letter) are must need and other characters can be anything . Now, I want that other charecter can be anyhthing except number. I replace * with [^0-9]. (?=(.*\d){2})(?=.*[A-Z])(?=.*[a-z])[^0-9]{8,} But, it does't work. Why?
  9. Sir, I want to make another regex that accepts any character at least 8 characters long except (0-9). How to write that? I try it like... [A-z!"#$%&'()*+,-.\/:;<=>?@[\]^_`{|}~]{8,} Can I write this same regexp in another way?
  10. Yes Sir, But in this way, if I want n digits then it needs to right n patterns! Sir, is it possible to do it in any other way?
  11. I try a RegExp for validation which Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters. <input id="name" pattern="(?=.*\d)(?=.*[A-z])(?=.*[a-z]).{8,}"> Now I want to modify it which input must contain two number instead of one number. I tried that like... <input id="name" pattern="(?=.*\d{2})(?=.*[A-z])(?=.*[a-z]).{8,}"> It works fine if I input two numeric digits Consecutive. Mean if I input 87aBcdfgf, then it is right. But 8aBcd7dfg input is wrong. Please, modify my RegExp. which can take input 8aBcd7dfg like that.
  12. I write an HTML code that takes input from the user which type="number". I also keep the user input value into a js variable. But when I check the data type of that variable it shows string...WHY? <html> <head> </head> <body> <input type="number" id="mynumber" value="2"><br> <p id="demo"></p><br> <button type="button" onclick="foo()">click here</button> <script> function foo () { var c = document.getElementById("mynumber").value; document.getElementById("demo").innerHTML = typeof c ; } </script> </body> </html>
  13. Okay sir , thanks for your helping hand
  14. Sir, Range() concept is somewhat difference than For Loop in C? or Same?
  15. okay, So, i make a little change to my python code... for i in range (0,10): print(i) print ("value of i after exit from loop",i) The loop will execute until the condition became FALSE. So, the loop will execute from 0 to (10-1) mean 0 to 9 and condition become FALSE when i become 10...(10<10-->False)...am i right? Let me to show that what i thinking... First it print, Loop Body (value of i) Increment (i=i+1) Condition (i<10) Status (T/F) --------------------------------------------------------------------------------------------------------------------------------------- 0 1 1<10 TRUE 1 2 2<10 TRUE 2 3 3<10 TRUE 3 4 4<10 TRUE 4 5 5<10 TRUE 5 6 6<10 TRUE 6 7 7<10 TRUE 7 8 8<10 TRUE 8 9 9<10 TRUE 9 10 10<10 FALSE So, the last value of i became 10 but when i print it show 9...Why? The process is also follows by C, am i right? But in the case of C it shows the result is 10...Why?
  16. Sir, I wrote the same code on Python and C. But the same code give two different result...my C code is... for (i=0;i<10;i++) continue; printf ("%d",i); and the my python code is... for i in range (0,10): continue print (i) The c code give 10 and python give 9 as result. So, what is loop execution process...what is the difference between loop execution process between Python and C?
  17. Sir, can I declare a Function with its return type and parameter's type on Python like C Language? void main() { void sum(int,int); /*function declaration*/ sum(5,5); } void sum(int x,int y)/*function defination*/ { /*function body*/ int result; result=x+y; printf ("The Sum is %d",result); } Can i do this same code on python? Python support Function Declaration? If yes, then how i declare a function on python
  18. List: collection which is ordered and changeable. But, if I create a list 'car' which is Unordered like that... car=["BMW","MAHINDRA","HERO","KTM"] print(car) SO, it does not support 'list' properties. But print result is ['BMW', 'MAHINDRA', 'HERO', 'KTM'] . Please help me that how it works even the 'list' is unordered, why it don't show any error message.
×
×
  • Create New...