Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Funce last won the day on August 6

Funce had the most liked content!

Community Reputation

28 Excellent


About Funce

  • Rank
    The Lookout
  • Birthday April 24

Previous Fields

  • Languages
    HTML, CSS, JavaScript, PHP, SQL, BYOND(DM)

Profile Information

  • Location
    New Zealand

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Apologies vmars, I didn't intend to sound condescending or aggravated. If that is what you heard then allow me to apologize again. I'll keep this one short. Take my For Loop Take the Original Drag Element Code Replace dragElement code with my Replacement dragElement code (changing "header" to "mydivheader") Result: https://www.w3schools.com/code/tryit.asp?filename=G75VCGLH4SCA
  2. You've made a lot of unnecessary changes to the dragElement function. The whole function was never designed in such a way that it would take a collection. If you take my first post with the DragElement function, then before it include the for loop I provided, you won't have too many problems. If you're unsure about the use of functions, invocations and how they apply, have a look here: https://www.w3schools.com/js/js_function_definition.asp If you're specifically looking at our example, I'll provide a small explanation. The purpose of dragElement is to bind some onclick events to the provided element. Depending on if it has a header or not, depends on whether the header gets the behaviour or the whole element. dragElement(document.getElementById("mydiv")) in this case here, elmnt would be the Element returned by getElementById. In our example, we're trying to do multiple at the same time, so we first get a list of the elements that have the mydiv class. Then we need to bind each and every one of them with on click handlers. Binding the collection does nothing, as its not an Element and lacks the properties for binding. So a for loop is used as shown in my previous post. This means you may treat elmnt, as any one of your given mydiv Elements. Not all of them at once. Only one.
  3. In the HTML code, there are references to the words that are shown, and the image that is shown. <div class="container"> <img src="img_avatar.png" alt="Avatar" class="image"> <div class="overlay"> <div class="text">Hello World</div> </div> </div> Replace img_avatar.png with the file name of your own picture on your site to include yours, and change "Hello World" to whatever you would like written when you hover over it. To make this a link, you should be able to apply an <a> tag around the container with the link you want it to travel to. If you instead want a button inside your text area, you can put your <a> tag in there.
  4. This was made bold to emphasize that you spelled it wrong (as Element instead) and to indicate plurality. dragElement is only supposed to take an element, therefore elmnt is an Element. Passing in a NodeList will give you that TypeError, as a NodeList does not have that function. If you include my for loop, as written in my previous, in your code, we can see what the error is going forward from there.
  5. You haven't changed your headers from id= to class= in your HTML Also, you'll need to loop through the collection provided by getElementsByClass by using a for loop, rather than directly putting it into dragElement var mydivs = document.getElementsByClassName("mydiv"); for (var i = 0; i < mydivs.length; i++) { dragElement(mydivs[i]); } Disclaimer: Untested
  6. vmars, did this solution not work out for you? The code above should work with this type of HTML provided you've applied dragElement to each one of these that you require. <div class="mydiv"> <div class="header">Click here to move</div> <textarea class="textArea" rows="4" cols="20"> </textarea> </div> dragElement specifically takes a "mydiv" Element. dragElement only applies the "draggable" behaviour to the header. The reason why the function takes the mydiv Element instead of the header, is that sometimes the header doesn't exist and in that case the "draggable" behaviour is applied to mydiv. In regards to that other code, the textarea probably prevents propagation of click events in its center area, so it cannot be dragged unless you're right on the edge.
  7. Hi there, thanks for pointing that out. There is additional styling on the main page, than as compared to the try-it. In particular img { vertical-align: middle; } If you were to add the vertical align property to the try-it, it would produce the same result as the CSS page.
  8. Sharing some code might work well here. It sounds like you're attempting to define a word that nodejs already uses. It might have nothing to do with your SQL. We can't know for sure without seeing a little bit of code.
  9. mysqli_stmt::bind_param binds each variable to a matching parameter. You cannot match all of them to one. It doesn't work like that. (Neither can you attempt to use a string like an array) What you can do however, is bind an array using variable length argument lists. Use ... to indicate an argument list as below. <?php $vals = [101, "ASUS H61M-E", "abcde", 2, 1, 5300.00, 6500.00, 11, 5300, 55528, 101]; $uq = $mysqli->prepare("UPDATE $tbl SET $cols WHERE $whcol='$whval'"); if (!$uq) { $msg = "Error1: $mysqli->error!"; } else { $uq->bind_param('issiiddiiii', ...$vals);
  10. This question is very vague. You need to debug the code, and you didn't write it. Can you post a snippet of the code that shows the form?
  11. Does the popup not show any link? What browser are you using?
  12. You aren't passing your ID along with your edit action. You need to add a line like this <?php echo "<input type='hidden' name='id' value='".$row['id'] ."' />"; Rather than Echoing all your output, have you considered the following method? (<?= ?> is shorthand for <?php echo ?>) <table class="table table-bordered table-hover table-striped"> <thead> <tr> <th>ID</th> <th>Produto</th> <th>Valor</th> <th>Ações</th> </tr> </thead> <?php if ($result->num_rows > 0) { ?> <tbody> <?php while ($row = $result->fetch_assoc()) { ?> <tr> <td><?= $row['id']; ?></td>"; <td><?= $row['produto']; ?></td>"; <td><?= $row['valor']; ?></td>"; <td> <form action='deletar_produto.php' method='post'> <input type='hidden' name='id' value='<?= $row['id']; ?>' /> <button type='submit' class='btn btn-outline-primary' name='editar'>Editar</button> <button type='submit' class='btn btn-outline-primary' name='apagar'>Apagar</button> </form>"; </td>"; </tr> <?php } ?> </tbody> <?php } else { echo "0 results"; } ?> </table>
  13. Everything working fine on my end. Maybe it was a temporary outage. Can you try it again? Unless you're creating your own try it as hypothesized by JMRKER. Then you've got a whole different kettle of fish.
  14. Hey there vmars, your issue here is that getElementByID only ever gets one element. getElementsByClassName gets a collection of elements, so some things needs to be adjusted. You'll need to apply the DragElement function to all of the Elements in the collection. (For loop might work well) Your headers will no longer work as they use the passed element's id. You'll need to apply a "header" custom class, one that will exist on all the headers. You can then access this header element for dragging purposes by using the below code. function dragElement(elmnt) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; if (elmnt.getElementsByClassName("header")[0]) { /* if present, the header is where you move the DIV from:*/ elmnt.getElementsByClassName("header")[0].onmousedown = dragMouseDown; } else { /* otherwise, move the DIV from anywhere inside the DIV:*/ elmnt.onmousedown = dragMouseDown; } Try this and then go from there. Code block button is here if you've missed it. ev.target evaluates into the element that has been activated using the event (onmousedown, onmousemove etc). That will always evaluate to the .mydiv that was clicked. So rather than document.getElementById, you use ev.target inside this function.
  15. Funce


    Map Coordinates? Is there a specific tutorial you are referring to? Or perhaps a map library that you're using?
  • Create New...