Jump to content

phppup

Members
  • Posts

    632
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

3,390 profile views

phppup's Achievements

Prolific Member

Prolific Member (5/5)

0

Reputation

1

Community Answers

  1. I think I'm on the right track now. Remembered how to LIST to avoid the overwrite. Also, my SIMPLE div with its unique id was AFTER the script (which apparently prevented ANY result from appearing in the area).
  2. Copied a wrong line. But still... fruits = ["apple", "orange", "cherry"]; for (x = 0; x< fruits.length; x++){ document.getElementById("demo").innerHTML = fruits[x]; } What would get this working? Would for each be any better?
  3. My code is a mess from various attempts at a simple task (it is embarrassing). And also frustrating (especially since my searching hasn't found a solution, or a more important explanation of WHY a method works). I want to have my stay contents displayed in a specific HTML container. fruits = ["apple", "orange", "cherry"]; x = document.getElementById("myList").innerHTML; for (x = 0; x< fruits. length; x++){ document.getElementById("demo").innerHTML = x; } I need a solution. And would appreciate comments for educational understanding. Thanks.
  4. Well, I'm not sure (because the whole point was to minimize code lines... LOL). And this was just a personal effort to see where it might lead me. I wouldn't have thought of using INCLUDES and I don't do well when I lose track of my (visible) code. The funny thing about this little project is that the"variables" are probably the most "constant" piece of the puzzle. That's why I thought FUNCTIONS would be a good step. In essence, some might be considered late after 5 minutes, others are 10. Some after 30, others 120. Hence, a different (short) function for each scenario. Essentially, the messages are the same: Your late, your very late, see your supervisor, go home fool, etc. regardless of "group." I'm still considering my options, and the other factors that might guide me. No hurry for this one.
  5. Ok. This is an interesting approach that I wouldn't have thought of on my own. I'm going to play with it and see if I can get more comfortable with it. Thanks again.
  6. So, $time is calculated elsewhere. What is (string) ?
  7. @ginerjmYes, and I appreciate your input. But the solution means that I have to include the array in every redundancy of similar functions that will use those variables. Without using functions at all,I can list the variables once and write straight code. Either way, something will be repeated, so I have to re-evaluate. At least NOW, I can make an informed decision.
  8. Just did more reading and I'll have to review my implementation. It seems that my attept to reduce (already short) code repetition will result in an increase of duplicated variable lists. But the effort was a learning experience. Thanks for the responses.
  9. If my argument list grows, is their a way to incorporate them all into an array to minimize replications of coding?
  10. I guess I can try that. Any other effective alternatives?
  11. I think I'd prefer to pass them as arguments. Can you save me the trouble of sorting through bad information from a search engine? (I've seen some info about using an ampersand, but it wasn't very clear) Are you saying that if I include the variables within the { } of the function that it will work? I tried that earlier but it failed. If these variables will be used as reference to other functions, Is there a Best Practices path to proceed on? Will wrapping the variables in a function of their own to be called inside of this function provide the desired result?
  12. While working with some code I wrote this and it works <? if(isset($_POST['submit'])) { $greeting = "Good morning"; $late = "You are late"; if($_POST['time'] > 0) { echo $greeting; } if($_POST['time'] > 5) { echo $late; } } ?> Then I decided to modify it into a function (which would be preferable for expanding the code's usefulness) That's when my problems began. What do I need to do so that the function works as well as the straight code? <? $greeting = "Good morning"; $late = "You are late"; function greet(){ if($_POST['time'] > 0) { echo $greeting; } if($_POST['time'] > 5) { echo $late; } } if(isset($_POST['submit'])) { greet(); } ?> I thought I'd ask the experts. Thanks.
  13. It seemed simple when I thought of it, but multiple variations are NOT producing the result I imagined. Essentially, I have a single table that I want centered on a webpage, with a second table to the right. <center><div> content </div> </center> <div style="float: right;"> content </div> I enclosed the tables in <div> tags but my results did not improve. I do not want two side by side tables that are centered. I am trying to have one centered table with a second to its right.
  14. What would be the car, in this instance? jQuery? The car has obvious advantages. (although there are far less deaths from buggy incidents per capita, so is the trade off worth it?) Not trying to be a smarty, but if you are referring to jQuery, I don't find it as straight forward as JS, so unless I'm missing some great advantage, I think I have enough troubles already. LOL As always, your insight and guidance are appreciated.
  15. It seems effective and it's what I'm accustom to. What is the new fangled option? Why use it other than to be more fashionable?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.