Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,935
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    Quote Originally Posted by Limey10 View Post
    Thanks Xelawho
    I inserted the following into HTML:
    Code:
    Your document will take approximately   
    <input type = "text" id = "Numdays" readonly />
    days to edit
    ...
    See, now, this is much less "scary". Don't be afraid to try things, even if they don't work.

    The fact that you used innerHTML instead of value is perfectly understandable. At least you got the important part right.

    Again, just *experiment*. That's the way I learned 95% or more of what I know of JavaScript. Never took a class, never read a tutorial. Just read the documentation and then started trying things. Out of the other 5%, I probably got 4% or more from reading other people's code (including forum postings) and somewhat less than 1% by asking questions. That's me. That's how I learn. But I do think that if you ask questions you should then try to understand the answers. And as many answers as you have had in the past, I would think that by now you should have known how document.getElementById() works.
    ...which now gives me a nice little box. I played around with the getElementById, I even researched it at w3schools.com (so that I would appear less scary when I ask for further help :-). I ended up with:

    Code:
    document.getElementById("Numdays").innerHTML = days
    ...but I think this is either wrong, or I am putting it in the wrong place (because it doesn't work).

    Having said all of this, i'm actually starting to like the alert that you created. I've changed it a bit to read:

    Code:
    alert("Your work will be completed within "+days+" days\nof payment confirmation\n\nPlease select OK to see your toal price");
    So it at least gives clients a hint as to how long their work will take.

    Thanks, Phil[/QUOTE]
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  2. #17
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,935
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    Note that you could have written that as
    Code:
    Your document will take approximately <span id = "Numdays" /> days to edit
    then the use of innerHTML with getElementById() would have been correct.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •