Jump to content

thescientist

Moderator
  • Posts

    8,682
  • Joined

  • Last visited

Everything posted by thescientist

  1. The issue you are experiencing here is what Dave J solved by using a closure. In your example, the reason you always get 6 is because that is the last value of i, since Javascript passes value by reference. So for every call to greetings, it will always output the last value assigned to i. To get around this, a closure can provide an isolated scope if you will, capturing the value of i for that unique iteration, so that value is preserved, and not always displaying the last value assigned to i. MDN has a good article on this. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures
  2. @danishwebindia A couple issues I see (in order of precedence) You haven't declared anything in ng-app. Without it, Angular will not initialize / bootstrap your application You have no controller. You need to have ng-controller="xxx" and create a controller in Angular to load your code and establish $scope in your DOM / application c isn't on $scope I would suggest you go back through and review the Angular tutorials and learn some of the basics. It does have a bit of a learning curve, but a simple little calculator like application like you are trying should be fairly straightforward. @Ingolme Angular is a front end MVC Javascript framework developed by Google.
  3. just because you have quotes _in_ it, does not mean it was syntactically correct. The entire string you were trying to generate needed be enclosed in quotes, just like the example you showed that worked.
  4. As alluded to, what kind of help are you looking for? As general observations, I will say that The if statement is incorrect, ballpool and minisoccer should be in quotes Your markup also needs to be in quotes You are repeating markup generation that you only need to do once. Perhaps something like this (which is easily extendable) <?php$game = $_GET["id"]; //make an array to store all specific properties of each game$gamesConfig = array( "ballpool" => array( "name" => "8-ball-pool-multiplayer" "height" => 520 ), "minisoccer" => array( "name" => "soccer-stars" "height" => 450 )); $output = ''; //test that the game provided existsif ($gamesConfig[$game]) { //get the config for the game $config = $gamesConfig[$game]; //build up the HTML using values from the config $output .= '<div id="miniclip-game-embed" data-game-name="' . $config["name"] . '" '; $output .= 'data-theme="0" data-width="750" data-height="' . $config["height"] . '" '; $output .= 'data-language="en"></div>';} else { $output = "Invalid Request";} echo $output; ?>
  5. When the other site redirects, it could send certain headers in the request body that your site is specifically expecting and checking for. For any site that doesn't have these specific headers / credentials, don't show your site.
  6. I see the element you need has an ID, right? <div id="ROOT/Favorites and Dashboards/6" class="x-tree-node-el x-unselectable x-tree-node-collapsed" unselectable="on" ext:tree-node-id="ROOT/Favorites and Dashboards/6"> Are you saying you can't find that element initially on redirect? Maybe you should add a sleep to your spec until Javascript has had a chance to inject that element into the page.
  7. That's awfully vague. How is it not validating? What do the docs say? What do you expect and what are you seeing?
  8. I think this thread is done. Please keep conversation civil and respectful at all time. That goes for all members of the forums.
  9. This is not a very good idea. Waiting for the DOM to be ready before manipulating it is the preferred way, in fact.
  10. what's your question? what have you tried?
  11. Which example(s) are you referring to? And which parts do you consider superfluous?
  12. that is referred to as responsive web design, of which a google search will yield many results. A popular framework supporting that design strategy is Bootstrap. http://getbootstrap.com/
  13. You should be checking your browsers developer tools for errors, but from what you provided, the first thing I see as an issue is that you are included jquery-ui _before_ jquery. It should be loaded after jquery. http://learn.jquery.com/jquery-ui/getting-started/ Aside from that, make sure you also have an element called #startDate.
  14. what do you get in the console? Can you share a link? Sounds like the CSS isn't loading correctly
  15. Manually. I have virtual machines to test IE on OSX, and test using devices when available (iOS, Android). Typically the first step is establishing which browsers and devices are expected, and determining how much effort it is to support older browsers / devices versus the time spent developing for them. note: I am moving this to general since this topic is not about version control.
  16. It would have worked if your jQuery selector matched your DOM, so instead of "example", you should have been using "fred" for value of name $('input[name="fred"]').textrange('replace', 'some text');
  17. The full details behind JSON and what constitutes JSON can be found here. http://json.org/
  18. alert is a native method (on the window object), and not a local variable http://www.w3schools.com/jsref/met_win_alert.asp
  19. The user that replied to you is named justsomeguy (JSG). I was asking if you followed his instructions to fix all your instances of using newline.
  20. did you change every occurrence like JSG recommended? It's not enough to change that one, you have fix all of them.
  21. if it's equal to 0, then it will evaluate to false.
  22. I wouldn't recommend that way, personally. It's not that hard to setup basic email sending with an HTML form and a little server side scripting.
  23. you can just use a form instead, there are tutorials for this on the w3schools site http://www.w3schools.com/php/php_mail.asp
  24. what's your question? It seems like something are out of order, you are checking in the weekdays array before you've defined anything. I'm not sure what the second case your testing for is, as you only specified two conditions in your post (and they seem to be the first and third cases in your if / else block). Essentially though, it seems like you want to test for two things per case: Check the day (is it Thursday or Friday) Check the time (before 9pm)
  25. no password checking? is username coming directly from GET / POST data? Also, won't this always be true? $_SESSION['addr'] == $_SERVER['REMOTE_ADDR']
×
×
  • Create New...