Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Everything posted by Don E

  1. Don E

    Browsing history

    I was wondering as to how websites display certain ads to you based of previous websites you've visited? Google Adsense for example can do this believe. So say you went to a website about sunglasses, and then go to another website having to do with something completely not related to sunglasses, but on that site you'll see ads served to you about sunglasses. I was just wondering how this is done since from what I understand you cannot access a users' browsing history via JavaScript. I read there are ways but they are considered 'hacks'. Not cool if that's what some of these sites are doing. Thanks.
  2. It's returning false because there is an error. Check to make sure your path is correct.
  3. There may be other ways but one way may work by using cookies. So in the insert function, you'll also create a cookie there indicating that the user has clicked and loaded the magic div. Also you'll have to create another cookie that stores the info the user typed into the magic input field. You can create another function that runs when the page loads that checks if these cookies are set or not. if it is set, that means the user filled in the info and left the page and has come back. If this is the case, then within the check function or however you do it, extract the data from the cookie(s) the user entered into the magic input field and set it to the sky div innerHTML. When I mentioned cookies, I mean JavaScript cookie(s) since you said you're unable to handle anything from the server-side. Hope this helps.
  4. One way would be is to get all the p elements inside the div element with the id of 'foobar' like: var div = document.getElementById("foobar"); var pElems = div.getElementsByTagName("P"); pElems will contain all the p elements that are inside the foobar div. You'd then loop through all them and check if the innerHTML of the p element is empty or not. If it is empty, you can use the removeChild() method to remove the empty p element from its parent, the foobar div.
  5. Just a quick question, who exactly determines what's considered bad practice or depreciated when it comes to JavaScript and HTML? I know W3C makes standards but for HTML and JavaScript, is it mostly what's going on in the development communities, meaning good practices, bad practices, are mostly opinions of web developers themselves?
  6. Don E

    Website logging

    I guess that is up to you really but what really matters is what you will do with the information you collect/log. In all fairness to the users of the internet that visit/use your site, it would be nice to have some kind of policy that explains what you're going to do with their info, what you collect from them while visiting your site etc; that's if you're going to do anything with it etc. As for too much logging on a website, just look at some of the "power house" websites out there like Facebook etc. They literally log and I may be wrong but they literally log almost everything you do on their site. Even when you're typing in your status update, or commenting, all that is being recorded and then used for advertising purposes on getting ads on your page depending on what you 'like' and talk about on facebook. They send out emails from time to time to their users explaining their privacy policy and what goes on with their info while on facebook but who knows what they're hiding and not really telling us. Recently I discovered that while making posts or comments on a public page, like say for the TV show The Walking Dead or comment on a image there, people on my friends list where getting notices on their newsfeed of what I was doing and saying on those public pages. I did not know that my comments and activities on public pages on facebook were 'visible' to my friends. Personally I feel that's private because what if what I am interested in a public page, I don't want my friends to see or know about for example? It's like your friends and relatives get text message notices when you visit a public place out somewhere like a certain bar or some social event you like to keep private. Anyhow, I learned that you can't do anything about it on facebook and it's 'how facebook works'.
  7. When you say replace the HTML inside the div tag, do you mean the text inside it? If so, it does change when you hover over it as niche mentioned.
  8. Don E

    [deleted]

    I see. I hope all is well now!
  9. See this link to give you more of an understanding of how to submit to a hidden iframe: http://stackoverflow.com/questions/8306640/use-hidden-iframe-to-submit-dataMake sure you set the iframe to be hidden.
  10. Yes can copy, see: http://us2.php.net/manual/en/function.copy.php Can also move a file by using the rename() function, see: http://us2.php.net/manual/en/function.rename.php
  11. Don E

    floating divs

    Try adding overflow: hidden to .container .
  12. Fox, just because I agreed on the not liking the auto-loading-never-ending scroll doesn't mean I shouldn't learn how to implement it incase I ever have to or asked to. Thanks for the tip.
  13. Hey everyone, I'm experimenting with something and was wondering if anyone can guide me in the right direction. Lets say I want to know how much a user has scroll down a page about 200 pixels for example and let the user know they done that or, as many of you know today on certain websites like facebook etc, have it where the user scrolls down a certain amount on their newsfeed page and new content is automatically loaded at the bottom. This fancy way of doing that takes away the need to have pagination links. So for simplicity, I'm experimenting with the following code where the console.log should alert when the user has scroll down 200 pixels but the problem is, the scroll amount is not incremented by one sometimes but instead three or four, etc etc, depending on how fast you scroll. <!doctype html><html><head><meta charset="UTF-8"><title>Scroll Check</title><script type="text/javascript">window.onscroll = function(){ var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; //console.log(scrollTop); // uncomment this to see the scrollTop value and you'll see how it increments. if(scrollTop == 200) { console.log(scrollTop); }}</script><style type="text/css"> #content { width: 500px; height: 2000px; background-color: lightblue;}</style></head><body><div id="content"> sdfg sdfg sd fg sdf </div></body></html> So my question is, how can we make sure that scrollTop value will contain 200(because as mentioned above, scrollTop will contain values like 192, 195, 196, 198, 201, etc; depends how fast you scroll I believe) when it reaches 200 when scrolling thus executing the if statement and console.log the value 200? Thanks.
  14. Don't forget about: http://www.eset.com/ When I was on windows, it was the only antivirus I ever needed/used along with malwarebytes of course.
  15. Try adding: overflow:hidden to the UPPER div. Just to add, using a doctype is also a good idea.
  16. Fox, that's exactly what I thought myself when I looked at the code earlier but I wasn't sure because the second closing brace after the if statement might be the closing brace for the isLoggedIn function?
  17. Don E

    Help Please..!

    Check out the Window object in JavaScript, innerHeight/innerWidth: http://www.w3schools.com/jsref/obj_window.asp
  18. Don E

    Help Please..!

    Would probably be a good idea to post in JS.
  19. Don E

    Help Please..!

    JavaScript maybe able to help you with that; in getting the width and height of a webpage.
  20. Hello everyone, Just a quick clarification... isn't something like the following suppose to give the "headers already sent" error? I tried the following and didn't get an error. <?phpsession_start();header('location: http://www.google.com');?> I read sometime ago that having session_start() and then have header() sometime after can cause the error. Thanks.
  21. Hello everyone, I've been searching around on the internet as to how to upload a file via ajax. I read that it is not possible but one way would be using iframe which I read is considered bad practice. I read up on other methods as well but many of the methods aren't really cross browser friendly and/or simply don't work. Any suggestions would be great. As I'm sure most are aware, facebook allows the user to upload an image without the page refreshing and I'm sure whatever method/way they are using is cross browser friendly. Thanks.
  22. The plus sign in Javascript (jQuery as well I'm sure) means to concatenate. Like how the dot in PHP is to concatenate, in JavaScript the plus sign is for that. The above would output: "Date stored: This is some data" I believe(not too familiar with jQuery).
  23. the id="n63" is for the <td> not the <input>. Try setting the id for the input to <input id="n63"....
×
×
  • Create New...