User Profile

Collapse

Profile Sidebar

Collapse
risk32
risk32
Last Activity: May 28 '10, 07:08 PM
Joined: Mar 6 '08
Location: Evansville, IN / Hurlburt Field, FL
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • risk32
    replied to document.getElementById isn't working
    I actually feel like an idiot. Even though the variable was assigned globally, it didn't read inside the function. So, I put it inside the function and added .value to the end for the alert. It's working. Now to figure out arrays...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to document.getElementById isn't working
    Where would be the appropiate location for the document.getEle mentById() method?...
    See more | Go to post

    Leave a comment:


  • risk32
    started a topic document.getElementById isn't working

    document.getElementById isn't working

    Hi all. I'm not exactly sure what I'm doing wrong, but when I try to use the document.getEle mentById() method, it's not working. Here's what I have:

    Code:
    var username = document.getElementById('username')
    
    function test()
    	{
    		document.write(username)
    	}
    
    ...
    
    Username: <input type="text" id="username">
    <input type="button"
    ...
    See more | Go to post

  • risk32
    replied to HTML link updates value for javascript
    I did find this, which seems a little more modern compared to marquees and ilayers...
    http://www.dynamicdrive.com/dynamici...e-scroller.htm
    Instead of using the two mentioned above, it uses an iframe to contain the scrolling text. In the external html file, there is a section for text that can be edited to display the content. Might be a bogus idea, but I thought about starting with a <p> tag that has an id, and using...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to HTML link updates value for javascript
    Gits,
    I am aware that modern browsers would not use this style of coding, however, this is just something that I stumbled upon. I have no idea how to do this myself, that's why I'm asking how to do it. Of course, not get an entire script built for me, but just something to point me in the right direction.
    See more | Go to post

    Leave a comment:


  • risk32
    started a topic HTML link updates value for javascript

    HTML link updates value for javascript

    Hi all,
    I have a quick question. I'm using Uncle Jim's vertical scrolling text script from
    http://jdstiles.com and I'm trying to modify it to suit my needs. I'm not sure if this can be done, but I'm trying to find some research on how to do it properly if it can. I have an href link on the page with the default location left blank, and a value that I need the JS to read and use it for the output. However, the scrolling text box won't...
    See more | Go to post

  • Lars,
    Looks like I got it to work with some tweaking. I kind of gave up on the percent thing. Sorry for making you go through all that trouble.

    The code I used to get the result to work like a normal calculator is:
    Code:
    function opAdd()
    {
    string1 = string.value
    operator = "+"
    string1 = parseFloat(string1) // thanks to gits for this one!
    string.value = ""
    ...
    See more | Go to post

    Leave a comment:


  • I get how to do it now, but it's not quite right. I added oldValue = oldValue + result to the end with the declaration being result=0. Maybe something I didn't need, but it's a piece of mind thing when I can see it. Anyways, I added some numbers together and it worked like a charm. Then I tried the percent...
    5+5+10+15 (no big deal... came out to 35)
    5 + 5 + 1 0 + 15 + 10% (NaN)

    This what got me thinking... a calculator...
    See more | Go to post

    Leave a comment:


  • Lars,
    It seems to work just fine. I'm trying to add the % function though. I know what it should look like in my head, but I can't seem to figure out using the code you gave me.
    Code:
    result = parseString(textField.value)/100 + (whatever the operator is) + oldValue;
    
    result = eval(result)
    
    result = parseInt(result)
    Could be wrong though...

    Thanks,
    Adam
    See more | Go to post
    Last edited by gits; Jan 17 '10, 09:45 AM. Reason: added code tags

    Leave a comment:


  • risk32
    started a topic Create an object after a button is pressed

    Create an object after a button is pressed

    Hi all,
    I'm still in the beginning stages of JS, so I really don't know how to do this.
    I'm trying to create a calculator, which I did, but I couldn't get the % to work.
    I thought maybe I could use the operator(s) to invoke some kind of function to put what was typed into a variable and then create a new variable for the next numbers instead of just evalutating one big string at the beginning.

    Here's where my head...
    See more | Go to post

  • risk32
    replied to infinite loop problem
    So it should look something like this:

    vairable...

    function run()
    {
    ...
    }...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to infinite loop problem
    Gits, where would be an effective place to put the count variable? I was thinking maybe before or after the
    Code:
    if ((true1 == 1) && (true2 == 1) && (true3 == 1))
    portion of code, but I'm not sure it would make a difference....
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    That's my mistake, I caught it after I posted. I have a new problem with an infinate loop though.
    See more | Go to post

    Leave a comment:


  • risk32
    started a topic infinite loop problem

    infinite loop problem

    Hello. I tried to create an alarm clock program that would loop until the desired time, then it would open an audio file based upon user choice. The program itself works perfectly... that is, until it reaches the alarm time. Then it loops infinately, trying to open WMP every second. Anyone have a suggestion as to how I can change / fix this issue? The coding is at the bottom, and yes, I code a little differently with my if statements...
    ...
    See more | Go to post
    Last edited by Dormilich; Oct 8 '09, 07:58 PM. Reason: could you not just check if at least the title is spelled correctly?

  • risk32
    replied to new Date() problem
    Still can't figure it out...

    So, this is what I finally came up with. The upper JS code works perfectly, but when I went to run it, it pointed to line 181, Char 1 with a 'Object Expected' code in IE... which led me to believe that either the html for the button to run the alarm is wrong (which I highly doubt) or it's something in the 'function run()' portion. I have no idea what it is... Could anybody help me to figure out what is...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    I'm having a problem with my .js file. I've got the countdown procedure for the alarm, but a setTimeout won't work. I used setTimeout("run ()", 1000); at the end of the function just before the last bracket. I figured out how to do the simple arithmetic with the remaining time, except for if the current time is in the next week. Still trying to work that out, but I haven't been able to come up with a solution. Any help on this? Here's the...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    Thanks acoder. I make some stupid mistakes sometimes. Is there a way to compare values and have a countdown timer for them to activate an event when the timer reaches 0? What I mean is, I can get the program to work if I run the program at the exact day, hour and minute. But if I don't, I'll need a function to get the milliseconds of the time it is now, figure out what that value would be for the alarm, subtract the values for the difference, and...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    I did a secondary test to see why the alerts were always failing. I used the document.write for currentDay and day to see what values they were holding. currentDay would return the correct day while day would return the first value in the select. Should I include an onChange function to change the value?
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    The comparison works, but there's something I must be missing. The alert I set up always returns a fail:

    Code:
    var currentDay = weekday[date.getDay()];
    var day = document.getElementById("day").value;
    if (currentDay == day)
     {
       alert('Check Passed');
     }
    
    else
     {
       alert('Check Failed');
     }
    I replaced the values for the...
    See more | Go to post

    Leave a comment:


  • risk32
    replied to new Date() problem
    Acoder, I found a round-about way to do it, but I'm having a variable compare issue. I'm trying to assign a variable an array value (IE doesn't like this).
    Code:
    function run()
    {
    
    var date = new Date(); 
    var hourNow = date.getHours(); 
    var minuteNow = date.getMinutes();
    var secondsNow = date.getSeconds();
    
    var weekday=new Array(7);
    weekday[0]="Sunday";
    weekday[1]="Monday";
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...