Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GaryNewport

Members
  • Joined

  • Last visited

  1. GaryNewport replied to GaryNewport's topic in Frontend
    Thanks for this, makes complete sense and something I should have spotted. Feel like I am having a 'stupid' set of moments currently.
  2. GaryNewport replied to GaryNewport's topic in Frontend
    Only that I have found in the past using DIVs offers much greater flexibility and control that using the buttons HTML code.
  3. GaryNewport posted a topic in Frontend
    I have a class that I am trying to adapt, but keep getting an undefined error. I am currently blind to the solution so am reaching out... <!DOCTYPE html> <html> <head> <style> .button { width: 40px; height: 40px; line-height: 40px; border: 1px solid #000; border-radius: 25px; font-family: "Comic Sans MS", cursive, sans-serif; text-align: center; margin: 0 1px 0 1px; float: left; } .button:hover { cursor: pointer; background-color: coral; } </style> </head> <body> <div id="buttons"> <div class="button">1</div> <div class="button">2</div> <div class="button">3</div> <div class="button">4</div> <div class="button">5</div> <div class="button">6</div> <div class="button">7</div> <div class="button">8</div> <div class="button">9</div> <div style="clear: both;"></div> </div> <script> function setup() { var buttons = document.getElementsByClassName("button"); sNo = parseInt(Math.random() * 2 + 89); if (sNo % 10 == 0) { buttons.style.backgroundColor = "cornflowerblue"; } else { buttons.style.backgroundColor = "gray"; } } setup(); </script> </body> </html>
  4. A site I am developing requires categories, topics and statements; a category can have many topics and one topic can have lots of statements. Users are limited to the statements they can see; but any interrogation of the system will require knowing the topics and categories for each statement. They want a menu system similar to the expandable side menu used by Windows Explorer. Do I interrogate the database and pull all the data, so the JS menu can simply reveal using the collected data (time consuming if lots of topics) or is there a better way? I can see that I cannot get JS to interrogate the database directly; that method would be a serious risk to data.
  5.    BrowserBugs reacted to a post in a topic: Recursive?
  6. GaryNewport replied to GaryNewport's topic in Frontend
    Found it! The increase in j took it beyond the length of the array, which generated an error (obviously) on that line. Why it restarted the function rather than cease running I do not know, but all fixed.
  7. GaryNewport replied to GaryNewport's topic in Frontend
    Okay, so I have undertaken some further testing by commenting out sections until I can isolate where the error is; it comes down to a single line: document.getElementById("val" + j).style.backgroundColor = colours[0]; If I comment out this single line of code (which colours the relevant divs from an array) everything (except the colouring, obviously) works fine. If I re-include this line then the boxes are coloured but we get in to the infinite loop situation once again. I know that the variable comment = 11, and so something is calling the main routine each time, which is selecting option 11; but what?
  8. GaryNewport replied to GaryNewport's topic in Frontend
    I have attached the file. It is a simple representation of a mergesort. I did wonder if I was altering the value of i, but this would not make sense since it is not simply in an infinite loop at that point, it is re-running the function from the very start - before the loop. So, if the calling of the function was in a loop I would understand, but it is not. Any help gratefully received. mergesort.html
  9. GaryNewport posted a topic in Frontend
    I have a segment of code... function mapPaired(noElements) { var colours; alert("start"); colours = ["lightCoral", "lightGreen", "lightBlue", "yellow", "mistyRose", "orange", "lightPink", "cyan"]; alert("in"); for (i = 0; i < 16; i = i + noElements) { for (j = i; j < i + (noElements + 1); j++) {document.getElementById("val" + j).style.backgroundColor = colours[0];} colours.shift(); alert("here" + i); } alert("out"); } When I run this with mapPaired(2); it displays the "start", followed by the "in" then counts through as I expect, showing the relevant "here". Colour shifting and allocation works, yet it never displays "out", instead showing "start" again?! This never ends (infinite loop) but there is no recursive statement, no resetting of i or j? COnfused!
  10. GaryNewport posted a topic in Frontend
    Okay, so I am familiar with the use of settimeout and setinterval but they seem so 'clunky' I want to delay text for a short while, then display and move to the next command. Ultimately I'd like to have options where the timer varies depending upon an outcome. Basically, are these the only two time-related commands available to me?
  11. I have a form where there is an input box with an ID. However, the ID is altered each time the form is run. The format is q?:1_answer where ? is an incremental value (for example, 11739, then 11740). I want to submit an automated response to the input box but cannot change it's behaviour. So, I need a line of Javascript that will identify the current ID for that instance of the input box on that particular moment in time. Anyone any ideas?
  12. Have this further down... if(password_verify($password, $hashed_password)){ I assume you mean this?
  13.    BrowserBugs reacted to a post in a topic: Clarification on Code
  14. Thank you. This all makes sense now. Sorry if this wasted your time; need to get my brain kick-started back in to all of this.
  15. Thank you Browser, makes absolute sense. And thanks for the update. I hadn't escaped the string because I chose to do this almost immediately: $post = filter_input(INPUT_SERVER, 'REQUEST_METHOD'); $username = trim(filter_input(INPUT_POST, 'username')); $password = trim(filter_input(INPUT_POST, 'password')); I understood that escaping was no longer the preferred option, and that filter_input did that and more?
  16. I am returning to PHP coding after a long break, and things have changed a little. I worked on prepared statements with SQL but have come across some code I would not mind some clarity on, if that is okay. $sql = "SELECT username, password FROM tbl_users WHERE username = ?"; if($stmt = mysqli_prepare($link, $sql)){ mysqli_stmt_bind_param($stmt, "s", $param_username); $param_username = $username; My first question is the second line: if($stmt = mysqli_prepare($link, $sql)){ This is an assignment in an IF statement; something that I do not feel is right. I'd rather assign and then test, but what would I need to replace this with? $stmt = mysqli_prepare($link, $sql) if(????){ Second. I was given the parameter binding, but wondered why I then assign a value to the binding? Why can't I simply change: mysqli_stmt_bind_param($stmt, "s", $param_username); $param_username = $username; into this: mysqli_stmt_bind_param($stmt, "s", $username); Sorry for what might be stupid questions, but I'd appreciate the assistance.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.