Jump to content

davej

Moderator
  • Content count

    3,960
  • Joined

  • Last visited

Community Reputation

247 Excellent

4 Followers

About davej

  • Rank
    davej
  • Birthday July 15

Contact Methods

  • MSN
    e-mail: davejonline@hotmail.com

Profile Information

  • Location
    STL
  • Interests
    Learning web development.

Recent Profile Visitors

72,556 profile views
  1. davej

    hex to binary conversion understanding

    Because it omitted the leading zeros.
  2. davej

    Blockchain

    Here is a discussion... https://www.youtube.com/watch?v=9s93uFphPb8
  3. davej

    Blockchain

    Well, I am aware of this, but I keep seeing claims that the "blockchain" itself is an important idea. For example it is claimed that IBM is working on 400+ different blockchain-based concepts. I think they are proposing that it can be useful for a variety of secure distributed/decentralized transactional systems.
  4. davej

    Blockchain

    Why is this said to be a critically important new technology?
  5. davej

    JAVASCRIPT

    You have html inside the script block so that isn't going to work, and the html should be above the script block.
  6. <?php session_start(); $pageLevel = "4"; $user = isset($_SESSION['user']) ? $_SESSION['user'] : ''; $userLevel = isset($_SESSION['userlevel']) ? $_SESSION['userlevel'] : ''; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <?php if ($user == '' || $userLevel == ''){ ?> <h1>Forbidden. You do not have permission to view this page.</h1> <?php }else if($pageLevel > $userLevel){ ?> <h1>Sorry <?php echo $user ?>. You do not have permission to view this page.</h1> <?php }else{ ?> <div id="content"> <h1>Welcome <?php echo $user ?></h1> <h4>This is the protected content.</h4> </div> <?php } ?> </body> </html>
  7. Although it works -- as a part of browser backward-compatibility -- I doubt that anyone recommends that approach anymore.
  8. davej

    Canvas image events?

    I am leaning toward positioning the images under the canvas and positioning matching divs over the canvas. That way the images are protected and the mouseover events can be assigned to the divs. <!DOCTYPE html> <html lang="en"> <head> <meta charset='utf-8'> <title>MouseOver Event on Canvas</title> <style> #container{ z-index: 0; position: relative; height:700px; width:700px; background-color: pink; } #myCanvas { z-index: 10; border: #333 10px solid; position: absolute; top: 50px; left: 40px; height: 600px; width: 600px; } #squ1 { /* opacity:0; */ border: 1px solid red; z-index: 20; position: absolute; top: 100px; left: 100px; height: 100px; width: 100px; } #squ2 { /* opacity:0; */ border: 1px solid blue; z-index: 20; position: absolute; top: 500px; left: 500px; height: 100px; width: 100px; } #pic1{ z-index: 1; position: absolute; top: 100px; left: 100px; height: 100px; width: 100px; } #pic2{ z-index: 1; position: absolute; top: 500px; left: 500px; height: 100px; width: 100px; } </style> </head> <body> <div id="container"> <div id="squ1"></div> <div id="squ2"></div> <canvas id="myCanvas"></canvas> <image id="pic1" alt="1"/> <image id="pic2" alt="2"/> </div> <script> document.getElementById('squ1').addEventListener('mouseover',squ1over,false); document.getElementById('squ2').addEventListener('mouseover',squ2over,false); var src1 = "https://uploads.guim.co.uk/2017/10/06/First-Dog-on-the-Moon,_L.png"; var src2 = "https://image.freepik.com/free-vector/cheese-cartoon_22350-100.jpg"; var img1 = document.getElementById('pic1'); var img2 = document.getElementById('pic2'); img1.src = src1; img2.src = src2; var canvas = document.getElementById('myCanvas'); function squ1over(){ alert('squ1 touched'); } function squ2over(){ alert('squ2 touched'); } </script> </body> </html>
  9. davej

    Canvas image events?

    If you have a canvas and you want to have some number of visible images on it with mouseover events (or the equivalent) for each image what is the most efficient approach to accomplish this? Is it possible to use the images in some manner with mouseover events? Or must I simply use the mousemove event and keep checking the mouse coordinates? Thanks.
  10. davej

    My Field Validation Code Not Working

    The Javascript thinks that name, email, and phone are the names of variables.
  11. davej

    Should I or shouldn’t I?

    A simple approach would be to go through the tutorials and then read each page of the references. HTML Tutorial HTML Tag Reference HTML Attribute Reference
  12. davej

    Testing a radio button ON or OFF?

    But... is he oversimplifying in his example? Does he ever use more than one name value?
  13. davej

    strpos

    Accidentally using truthiness...
  14. davej

    Testing a radio button ON or OFF?

    You need to clarify what you are trying to do. You are not allowed to have two identical id values on the same page because that is illegal HTML. Also these id values seem to be unnecessary -- they don't serve any purpose. Also if these radio buttons all have the same name then ONLY one of them can be checked.
  15. davej

    Class Variable Declaration

    Instance variables are usually declared as private because OOP considers "encapsulation" to be a good thing. This is the same reasoning behind minimizing the number of global variables. If some variable does not need to be public or global then it shouldn't be. In your example the constructor sets the values of the instance variables, so they themselves don't need to be public.
×