Jump to content

Funce

Moderator
  • Content Count

    369
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by Funce

  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

    silleone

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

    TLJ232

    You might be able to do something like this. SELECT myFieldA FROM myTable WHERE (myFieldA - Trunc(myFieldA, 2) <> 0); Anything with a 0 decimal should end up as 0 and would be omitted. You can reverse this by changing <> to =
  17. Hi there Alejandro, The JSON HTML page is different to the JSON PHP due to what they are illustrating. Unlike some of the other tutorials, they do not use sequential examples. This is to avoid someone having to learn a lot of unrelated things to the page that they're currently on.
  18. <li> elements are block level tags, which means they usually take up the full page width, forcing the next li element to go on the next line. By floating them, we can take them out of normal page flow, and put them next to each other. Putting the float in li means that we float the li. This is the reason why its horizontal. Styling li a is actually styling the links and not the container. The container (li) normally goes vertically
  19. Ouch, yeah you're getting undefined because you're accessing the <select> element that has no data on it. You'll need to put what you had earlier to access the <option> element. <script> function eventFunction(eventname){ var selected = eventname.options[eventname.selectedIndex];//get the selected option var date = selected.dataset.eventdate;//get the data attributes of above var venue = selected.dataset.venuename; document.getElementById("eventdate").value=date;//set the data document.getElementById("venuename").value=venue; } </script> Hopefully this helps.
  20. Why would you need to remove the timestamps? You should be able to do this with a simple find and replace using a regular expression. ^<gx:TimeStamp>.+<\/gx:TimeStamp>$ The above should filter all the lines that match <gx:TimeStamp> blah blah </gx:TimeStamp>
  21. Hey there Jenny, Can you include some code for us so we can see what's going on here?
  22. You can use any given Bootstrap 4 page by erasing what's there and then adding the code you wish to test.
  23. Is this code incomplete? There's nothing to suggest that this would do anything of what your saying. With no content and that styling, the table actually shows up at a whopping 6 by 6 pixels. Nowhere close to twice a 4K monitor. Also trying using a code block to better highlight your code.
  24. You could try using relative to root links, that way if the current page changes, moves or duplicates, they still point to the same place. The only thing with this is you'll need to update them all should you need to move any of the linked pages. Relative to root paths start with '/' and are relative to wherever is "https://url.domain/index.html" (for example) <a href="/path/to/file.html">Link</a> So if you wanted to find https://w3.schools.invisionzone.com/topic/59575-html-header-tag/ (this thread) You would go like this <a href="/topic/59575-html-header-tag/">This Thread</a>
  25. Funce

    SQL Dates Between

    What's your current SQL code looking like? What are the errors? For all we know your computer could be on fire, and that's why it doesn't complete the query. However, this doesn't sound too difficult, replace the "date"s below to your form references (too long ago since I did MS access to remember how it works) SELECT * FROM table WHERE date BETWEEN "date_from" AND "date_to"
×
×
  • Create New...