Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. You are comparing the natural flow of inline elements vs the effect of float on block objects. If you are learning about float I would suggest that you make the blocks different sizes.
  2. davej

    @font-face help...

    Maybe try the Google hosted version? <link href='https://fonts.googleapis.com/css?family=Fira+Sans:400,700italic,700,500italic,500,400italic,300italic,300' rel='stylesheet' type='text/css'> <style> h1{font-family: 'Fira Sans', sans-serif;} </style>
  3. davej

    Div tag problems

    A picture is worth a thousand words. Can you provide a picture of what you want?
  4. I've never used the MySQL event scheduler but all the documentation is online... http://dev.mysql.com/doc/refman/5.5/en/events-configuration.html
  5. Yes, but have you tried using a SQL command that is always SUCCESSFUL in the MySQL console?
  6. What the heck is this? <li><a href+ "#" Also who wrote all this code? Why not start with something simpler and get it to work first?
  7. davej

    Image Change

    You also could try this... <script> 'use strict'; var phot = [ 'path0.jpg', 'path1.jpg', 'path2.jpg', 'path3.jpg', 'path4.jpg', 'path5.jpg']; var i = Math.floor(phot.length*Math.random()); document.getElementById("myImg").src = phot[i]; </script>
  8. davej

    Masonry with CSS

    If you want an image to maintain its own correct aspect ratio then normally you have to allow the image to find its own height.
  9. Clearly describe what you want to happen.
  10. davej

    Masonry with CSS

    Looks pretty simple, so go write the code. What do you mean "correct height?" Responsive means you use % widths and media queries.
  11. Have you read the documentation? http://dev.mysql.com/doc/refman/5.5/en/events-overview.html
  12. davej

    Image Change

    If you want to cycle through them you'll need to save the index as a cookie or in local storage. Even with a random selection you may want to save the old index just to prevent repeats. Here is a simple random approach... <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>test</title> <style> #myImg{width:200px} </style> </head> <body> <img src="#" id="myImg" alt="no image found"/> <script> 'use strict'; var phot = []; phot[0] = 'path0.jpg'; phot[1] = 'path1.jpg'; /* ... */ phot[9] = 'path9.jpg'; var i = Math.floor(10*Math.random()); /* random 0 - 9 */ document.getElementById("myImg").src = phot[i]; </script> </body> </html>
  13. Rename home.php to index.php or default.php Set the src attributes of the iframes to the initial pages that you want to load.
  14. The deeper topic... https://en.wikipedia.org/wiki/Iterator https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators http://php.net/manual/en/class.iterator.php
  15. See... http://www.w3schools.com/sql/sql_update.asp
  16. Huh? If you don't want to put text-align:center on the body, then you could put a div around your button and apply text-align:center to that added div.
  17. Add text-align:center to the body style.
  18. It's usually best to keep position absolute inside position relative. For a normal layout you should be using the natural flow of the page.
  19. That's true. As I said above, it depends on the amount of "clutter" on the page.
  20. The only issue with that is if they click outside the inner div but click on some other element other than the outer div itself.
  21. I had trouble with event bubbling -- or the wrong element being clicked on. edit 5:52pm cdt
  22. Seems like it can be a little tricky if there is a lot of clutter... <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>test</title> <style> #outer{ position:relative; border:1px dotted green; height:500px; } #inner{ position:absolute; background-color:red; border:1px dotted red; top:100px; left:100px; right:100px; bottom:100px; } #other1{ border:1px dotted orange; height:400px; width:50px; } #other2{ border:1px dotted green; height:100px; width:200px; } </style> </head> <body> <div id="outer"> <div id="inner"> <div id="other2"> </div> </div> <div id="other1"> </div> </div> <p>I want to hide the inner div if and only if the user clicks on the outer div.</p> <script> document.getElementById('outer').onclick = fout; function fout(e){ var i = e.target; var t = document.getElementById('inner'); var inner = false; if (t.style.display != 'none'){ while(i.tagName != 'BODY' && inner === false){ if (i === t){ inner = true; } i = i.parentElement; } if (inner === false){ alert('hide inner'); t.style.display = 'none'; } } } </script> </body> </html>
  23. As a starting point it is important to use prepared statements. See... http://www.w3schools.com/php/php_mysql_prepared_statements.asp ...and use POST, in the form tutorial beginning here... http://www.w3schools.com/php/php_forms.asp ...but then you need to use SQL such as... SELECT * FROM usertable WHERE userid = ? AND password = ? ...and once you have that simple approach working then you need to look at hashing functions... https://duckduckgo.com/?q=hashing+passwords+php
  24. davej

    php & sql problem

    Where do you bind your values? http://www.w3schools.com/php/php_mysql_prepared_statements.asp http://lmgtfy.com/?q=pdo+sql+example
  25. I don't know the rules for the game Craps. Shouldn't the value of roll change inside the while loops? As I mentioned single-stepping is usually helpful.
×
×
  • Create New...