Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Your code doesn't resemble the one from the article I linked you to. http://www.quirksmode.org/js/events_properties.html#position Read the article again and read their explanations.
  2. Ingolme

    http function

    Well, here's an example of how it's used: $url = 'http://example.com/data.txt';$data = 'Some information';$response = http_put_data ( $url , $data );echo $response; I don't think the HTTP PUT method is what you need, though. This function sends a PUT request, but doesn't guarantee that the server will actually do anything.
  3. Ingolme

    http function

    The PHP manual explains the function here: http://php.net/http_put_data An understanding of the HTTP Protocol is necessary to fully understand PHP's http functions.
  4. Well, I'm just going to organize your code a bit and make it work and hopefully you can learn by comparing to the code you started off with <!DOCTYPE html><html> <head> <title>Javascript and buttons</title> <script> function updateTxt(inputID, outputID){ var inputElement = document.getElementById(inputID); var outputElement = document.getElementById(outputID); outputElement.innerHTML = inputElement.value; } </script> </head> <body> <div> My Name: <input type="text" id="myname"><br> Son's Name: <input type="text" id="sonsname"><br> Country: <input type="text" id="country"><br> <button type="button" onclick="updateTxt('myname', 'output1'); updateTxt('sonsname', 'output2'); updateTxt('country', 'output3');">Run</button><br> <p>My name is <span id="output1"></span>, and i named my son <span id="output2"></span> too. We live in <span id="output3"></span>.</p> </div></html>
  5. You're not passing the same parameters in the <button> element as in the <input> elements. updateTxt(toField, toField2) is not the same as updateTxt('box1','txt1', 'txt111') toField and toField2 don't have a value in that context either, so it's not going to do anything.
  6. The opacity property makes the entire element transparent, as a result the text inside it also has opacity. If you just want the background transparent rather than the element itself you can use rgba() color codes. http://www.w3schools.com/cssref/css_colors_legal.asp
  7. Ingolme

    PHP Str_replace

    You can, but it would actually look for an array inside the other array, which wouldn't be useful for this purpose.
  8. I would recommend reading the thread more thoroughly before trying to answer.
  9. Ingolme

    PHP Str_replace

    Here's an example, but it would be more convenient for your career as a PHP programmer if you tried to piece things together on your own. $sentence = 'I hate you';// Turn the sentence into an array of words$words = explode(' ', $sentence);// in_array() will tell you if a value was found in the array// Using the ! (NOT) operator we can tell if the value was NOT found in the arrayif( !in_array('hate', $words) ) { // Execute the SQL query because the word was not found}
  10. I think this can be solved with a bit of Javascript. You can use window.open() to create a new tab (not window) but when the user clicks the link it will focus the window instead. var win;// Execute openTab when the link is clickedfunction openTab() { // If there's already a window, focus it if(win) { win.focus(); } else { win = window.open("document.html"); } return false;} If you want to get a bit more into Javascript, it would be convenient to use the event object and methods like preventDefault() to stop the link from activating when Javascript is available but I'm just putting a simple code here to show the idea.
  11. Ingolme

    PHP Str_replace

    You can use strpos() to see if the word exists in the string, though it doesn't take spaces into account. if(strpos($value, 'word') === false) { // If the word wasn't found then execute the SQL query} Other solutions would be more complex.
  12. Javascript usually will create a new window when you set width and height parameters in the window.open() method. Are you sure your users would prefer your website to open a new window rather than a tab? You must try to make your website easy to use.
  13. What do you mean "edit"? Both of your examples do different things.
  14. You can't do it with HTML. It's up to the user to decide how they want their links to behave, most browsers have an option for the users to choose how they want new windows to appear.
  15. Read this article: http://www.quirksmode.org/js/events_properties.html#position Remember that Internet Explorer needs the global window.event property, so add this into your function: if(!event) event = window.event
  16. Ingolme

    Phpfiddle.org

    I never heard of it, but if it's a website that lets you test PHP then I'm assuming somebody hacked it and did something that violated the web host's terms of service.
  17. What are you expecting it to do? What is it doing?
  18. There are far more variable names in use than just the ones you declare, so there's no way to just get a list of the ones you created .The question is why you need them, though. This will show you everything that's in the global scope but it's probably much more than what you want to see. var output = "";for(i in window) { output += (typeof window[i]) + " " + i + " : " + window[i] + "n";}alert(output);
  19. It depends on what you're using the line for. CSS is used for styling purposes. You can apply a left or right border to your element using the CSS border property. If you're using columns of text, lines can be placed between the columns using the column-rule property I recommend not using the <hr> element solely for decoration, use border-bottom instead. The <hr> element is meant to signify a change in the topic being written about before and after the line, as described here: http://www.w3schools.com/tags/tag_hr.asp
  20. Elements that are not supported in HTML 5 are ones that were already discouraged in HTML 4.01. I recommend reading the HTML tutorial first and then moving on to HTML 5.
  21. Ingolme

    IFRAME issue

    Some websites don't want their pages loaded in iframes and you have to respect that. There's no way around the frame protection.
  22. You need the this keyword unless you only want the method to be accessible from inside the object. var GameObject = function(...) { ... this.draw = function() { - }}
  23. As long as the <td> elements have borders the borders should show up when printed. You can specify a print stylesheet to make sure of it using @media print You can prevent a table from breaking using the page-break-inside rule. As in this example @media print{p {page-break-inside:avoid;}}
×
×
  • Create New...