Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. Does the Safari console show any errors? https://support.apple.com/guide/safari-developer/debugging-overview-devd24689f72/mac
  2. Are you saying that you don't want to allow external links to the file? What about bookmarking?
  3. You want a Php variable to count up the checkboxes in this manner, but don't you also want to know which exact checkboxes were checked?
  4. Because it omitted the leading zeros.
  5. davej

    Blockchain

    Here is a discussion... https://www.youtube.com/watch?v=9s93uFphPb8
  6. 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.
  7. davej

    Blockchain

    Why is this said to be a critically important new technology?
  8. 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.
  9. <?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>
  10. Although it works -- as a part of browser backward-compatibility -- I doubt that anyone recommends that approach anymore.
  11. 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>
  12. 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.
  13. The Javascript thinks that name, email, and phone are the names of variables.
  14. 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
  15. But... is he oversimplifying in his example? Does he ever use more than one name value?
  16. davej

    strpos

    Accidentally using truthiness...
  17. 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.
  18. 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.
  19. Seems odd to me that you declare all of the instance variables as public. It is more normal to make them private.
  20. Be aware that it is always to the benefit of the student to modify the code in the Tryit editor in order to verify your understanding of whatever is presented. In the code you mention it is difficult to guess whether the student would know that the following is equivalent... var myResult = myFunction(3,4); // call the function document.getElementById("demo").innerHTML = myResult; // display the result
  21. davej

    HTML 5.

    Screen capture images are inappropriate for posting code. Use the code block <> provided in the online editor and paste in your code. SynWrite is merely an editor and has no relevance to your question. I have no idea what a "restore down" button is supposed to do. If your web page is live online then simply supply the link.
  22. As a last resort you can, of course, paste your entire stylesheet into a style block in the head.
  23. Did you get rid of the default margins and padding? Also be aware that whitespace can create gaps between inline blocks.
  24. You have ten jpg images that are each over 100kb. One of them is 1.1mb. Use media queries to eliminate these images for small mobile devices. @media screen and (max-width : 480px) { .bigimg{ display:none; } } Or create smaller versions of these images for mobile devices.
×
×
  • Create New...