Simple JavaScript I just can't get to work

Hi guys I'm new here and to JavaScript really but I have had a go at trying this and it simply wont work for me. Basically I am creating a time-card for my work and because most people dont use military time the total calculations for each day have to take this into account. So I tried to make a script that would +12 if the total number of hours was less than 0; however it doesn't seem to work and still shows the negative number even though I have scripted it not too. I have attached the script bellow and if anyone could assist me it would be greatly appreciated.
// Start Time
var v1 = getField("Text1").value;
// Finish Time
var v2 = getField("Text2").value;
// Lunch
var v3 = getField("Text3").value;
// Total Hours
event.value = v2 - v1 - v3;
if(parseInt(event.value < 0 )) event.value = (parseInt(event.value) + 12).toString();
many thanks

Are the start and end time values being treated as numbers or strings by JavaScript?
What is the formatting of the field?
// Start Time
var v1 = getField("Text1").value;
// Finish Time
var v2 = getField("Text2").value;
// Lunch
var v3 = getField("Text3").value;
// Total Hours
event.value = v2 - v1 - v3;
if(parseInt(event.value < 0 )) event.value = (parseInt(event.value) + 12).toString();
console.show();
console.clear();
console.println("v1: " + v1);
console.println("type of v1: " + typeof v1);
console.println("v2: " + v2);
console.println("type of v2: " + typeof v2);
console.println("v3: " + v3);
console.println("type of v3: " + typeof v3);
Using civilian 24 hour time format for the fields, I get the following result:
v1: 9:00
type of v1: string
v2: 17:00
type of v2: string
v3: 0:30
type of v3: string
The calculation results in a NaN value.

Similar Messages

  • My printer is on line i just can not get it working on my laptop

    my printer is on line i just can not get it working on my laptop

    Hi @murphyett , 
    Thank you for visiting the HP Support Forums and Welcome. I have read about your HP Printer and not working Wirelessly. Here is a link to the HP Print and Scan Doctor. The HP Print and Scan Doctor will run a check on your system.
    What is the model of printer? I would be happy to assist if needed as there are many models of HP Printers I would need the model number. How Do I Find My Model Number or Product Number?
    Please respond with which Operating System you are running:
    Which Windows Operating System am I running?
    Please let me know.
    Thanks.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • ADSL 2+ I just can't get it working

    So in March we get a new upgraded 21CN exchange (stanford in the vale) I'm 1.2 km from the exchange so am expecting 17mb apparently - my next door neighbour calls Zen and gets an immediate speed increase to 17mb I call BT CS and get the usual runaround after two hours I give up with them. It finally turns out the exchange is out of capacity so I need to wait until end of Sept, after BT wholesale in sept confirm we have capacity I still only have 8 MB so call CS again they suspect a fault so after several calls and testing 6 hrs later I give up. next week I try again and need to call 5 different numbers all with no progress until I somehow get back to Sales who are very apologetic and suggest that I should renew my contract and this may get Openreach to connect me to a full speed service.
    Wow I now have 9.3 mb i don't use a HH preferring a Netgear DGND3700 however I always test wth the HH on the master socket, I'm still expecting 17mb as BT promised however it's still just 9mb. My test with the HH is even stranger it reports a 14mb connection but can barely load the BT wholesale speed test page at all with a wired connection.
    I have run out of patience with BT CS can anyone help here.
    Thanks
    ADSL Link Downstream Upstream
    Connection Speed 10949 kbps 704 kbps
    Line Attenuation 20.0 db 11.5 db
    Noise Margin 3.1 db 6.8 db
    Solved!
    Go to Solution.

    welcome to the BT community forum where customers help customers and only BT employees are the forum mods
    in order for the forum members to help please can you post the adsl stats from your router you may need to 'show detail' to get all stats (if hub enter 192.168.1.254 in your browser and navigate to adsl or if HH4/5 then go to troubleshooting then logs and you are looking for 2 line together when hub last connected to internet and they will show your connection speed and noise margin or if netgear enter 192.168.0.1). Then run  btspeedtester  (MAC users may have problems). when first test completes then run diagnostic test and post the results ( do not reset the router).
    are you connected directly via a filter to the NTE5 master or test socket or to somewhere else? Is the master the only phone socket in your home?
    Have you tried the quiet line test? - dial 17070 option 2 - should hear nothing - best done with a corded phone. if cordless phone you may hear a 'dull hum' which is normal
    Someone may then be able to offer help/assistance/suggestions to your problem
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • Port 8080: I know this is simple, I just can't get it to work.

    I'm trying something that I'm sure is relatively simple. But I just can't get it to work. I have OSX Server 10.4.10. I currently have my company site (www.example.com) hosted on it. But I'm trying to get another site hosted on it at port 8080. When I enter my company domain, www.example.com:8080, the page can't be displayed. But when I enter the IP address, such as 192.168.xxx.xxx:8080 from within my network, the correct site shows up. How can I get a website displayed at port 8080 from outside my network? I'm running DD-WRT on my router and have ports 80 and 8080 directed to the IP address of my server.
    Thanks in advance for any help.

    Hi WiFiNetGuy-
    I am a tad confused, which isn't new, but I need to get a grasp on exactly what it is that you are trying to do.
    Do you have both websites (i.e. www.example1.com and www.example2.com) both pointed at the same ip address? How many unique domain names and ip addresses are we talking about?
    From what you describe it sounds like a routing issue but I need more info (:>)
    Luck-
    -DaddyPaycheck

  • I have been using my apple tv to access netflix for several months.  It suddenly stopped working.  When I try to go to netflix from the menu, it says "accessing netflix" but never does.  I can access you tube just fine, but just can't get to netflix.

    I have been using my apple tv to access netflix for several months.  It suddenly stopped working.  When I try to go to netflix from the menu, it says "accessing netflix" but never does.  I can access you tube just fine, but just can't get to netflix.  Any ideas.  I have unplugged everything and waited but nothing helped. 

    Update software. If that doesn't work try resetting.  Mine started working after the update.

  • My iPhone 4s Bluetooth is not working, I have ios 5.1 but just can't get my Sony erricson hbh-pv715 headset to connect to the phone,  the phone can't find any Bluetooth device, can you help please

    My iPhone 4s Bluetooth is not working, I have ios 5.1 but just can't get my Sony erricson hbh-pv715 headset to connect to the phone,  the phone can't find any Bluetooth device, can you help please

    Yes it's in pairing mode, it worked fine with the 3GS but doesn't seem to work with the 4s,  my 4s can't find any other bluetooth device, I think the problem ls with apple?

  • I just can't get it to install

    At fist i couldent get my ipod to sync.  was recomended to uninstall and re install.  Well no i cant install itunes.  I get to the window that says save file and then nothing happens.  I can't find any install files any where in my computer.

    I get to the window that says save file and then nothing happens.
    Try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/itunes/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?
    If you still can't get a working installer from the standard download page, try the following direct download links for 11.1.5.5:
    iTunes 11.1.5 for Windows (32-bit) - iTunesSetup.exe (2014-02-25)
    iTunes 11.1.5 for Windows (64-bit) - iTunes64Setup.exe (2014-02-25)

  • EAP-FAST on Local Radius Server : Can't Get It Working

    Hi all
    I'm using an 877w router (flash:c870-advsecurityk9-mz.124-24.T4.bin) as local radius server and have followed various config guides on CCO. LEAP works fine but I just can't get EAP-FAST to work.
    I'm testing with win7 client using anyconnect secure mobility client, and also a mac book pro but without luck.
    the router sees unknown auth type, and when I run some debugs it talks of unknown eap type 3
    sh radius local-server s
    Successes              : 1           Unknown usernames      : 0        
    Client blocks          : 0           Invalid passwords      : 0        
    Unknown NAS            : 0           Invalid packet from NAS: 17      
    NAS : 172.27.44.1
    Successes              : 1           Unknown usernames      : 0        
    Client blocks          : 0           Invalid passwords      : 0        
    Corrupted packet       : 0           Unknown RADIUS message : 0        
    No username attribute  : 0           Missing auth attribute : 0        
    Shared key mismatch    : 0           Invalid state attribute: 0        
    Unknown EAP message    : 0           Unknown EAP auth type  : 17       
    Auto provision success : 0           Auto provision failure : 0        
    PAC refresh            : 0           Invalid PAC received   : 0       
    Can anyone suggest what I might be doing wrong?
    Regs, Tim

    Thanks Nicolas, relevant snippets from config:
    aaa new-model
    aaa group server radius rad_eap
    server 172.27.44.1 auth-port 1812 acct-port 1813
    aaa authentication login eap_methods group rad_eap
    aaa authorization exec default local
    aaa session-id common
    dot11 ssid home
    vlan 3
    authentication open eap eap_methods
    authentication network-eap eap_methods
    authentication key-management wpa
    ip dhcp pool home
       import all
       network 192.168.1.0 255.255.255.0
       default-router 192.168.1.1
       dns-server 194.74.65.68 194.74.65.69
    ip inspect name ethernetin tcp
    ip inspect name ethernetin udp
    ip inspect name ethernetin pop3
    ip inspect name ethernetin ssh
    ip inspect name ethernetin dns
    ip inspect name ethernetin ftp
    ip inspect name ethernetin tftp
    ip inspect name ethernetin smtp
    ip inspect name ethernetin icmp
    ip inspect name ethernetin telnet
    interface Dot11Radio0
    no ip address
    encryption vlan 1 mode ciphers aes-ccm tkip
    encryption vlan 2 mode ciphers aes-ccm tkip
    encryption vlan 3 mode ciphers aes-ccm tkip
    broadcast-key vlan 1 change 30
    broadcast-key vlan 2 change 30
    broadcast-key vlan 3 change 30
    ssid home
    speed basic-1.0 basic-2.0 basic-5.5 6.0 9.0 basic-11.0 12.0 18.0 24.0 36.0 48.0 54.0
    station-role root
    interface Dot11Radio0.3
    encapsulation dot1Q 3
    no cdp enable
    bridge-group 3
    bridge-group 3 subscriber-loop-control
    bridge-group 3 spanning-disabled
    bridge-group 3 block-unknown-source
    no bridge-group 3 source-learning
    no bridge-group 3 unicast-flooding
    interface Vlan3
    no ip address
    bridge-group 3
    interface BVI3
    ip address 192.168.1.1 255.255.255.0
    ip inspect ethernetin in
    ip nat inside
    ip virtual-reassembly
    radius-server local
    no authentication mac
    nas 172.27.44.1 key 0 123456
    user test1 nthash 0 B151E8FF684B4F376C018E632A247D84
    user test2 nthash 0 F2EEAE1D895645B819C9FD217D0CA1F9
    user test3 nthash 0 0CB6948805F797BF2A82807973B89537
    radius-server host 172.27.44.1 auth-port 1812 acct-port 1813 key 123456
    radius-server vsa send accounting

  • I have 2 itunes accounts - one work a/c and one home a/c, but when i sign in at home only my home songs appear even if I sign in my work a/c. I have authorised both computers to show both a/cs. How can I get my work a/c songs to appear at home?

    I have 2 itunes a/cs one at work and one at home. Both computers are authorised for the 2 a/cs, but I can;t get my work a/c songs to show on my home computer, even though I sign in my work a/c, and I can't get my home songs to show up on the  work computer even though I sign in my home a/c. V. frustrating!

    Hi,
    You will have to manually copy your music. Get a pen-drive big enough to accommodate all your music. And follow these steps:
    1. Create a new folder on the pen-drive.
    2. Copy the music from your work computer to the folder you just created. It's in (yourhomefolder)>Music>iTunes>iTunes Media>Music if you're using a Mac, or in C:\Users\(yourusername)\Music\iTunes\iTunes Media\Music if you're using Windows.
    3. Now on your home computer quit iTunes, and copy your music from work to the "Automatically Add to iTunes" folder in (yourhomefolder)>Music>iTunes>iTunes Media.
    4. Start iTunes. It will automatically start to process the files and move them to the appropriate place.
    Repeat these steps with your music from home on your work computer. Also I suggest to use only one iTunes account if possible.
    Hope it helps
    Regards,
    Gábor

  • Can't get vsftpd working

    i can't seem to get my vsftpd setup working.  I want to allow logging in anonymous so that pacman can use it becuase i setup a small local mirror so that my two desktop, my laptop and my brother's laptop could use within my local network.  I'm running vsftpd as a stand-alone service and here is my vsftpd.conf file:
    listen=YES
    tcp_wrappers=YES
    anonymous_enable=YES
    local_enable=YES
    ftp_username=mirror
    nopriv_user=nobody
    anon_root=/home/mirror/files
    write_enable=NO
    no_anon_password=YES
    anon_upload_enable=NO
    anon_mkdir_write_enable=NO
    anon_other_write_enable=NO
    anon_world_readable_only=YES
    anon_max_rate=0
    idle_session_timeout=200
    data_connection_timeout=30
    connect_from_port_20=YES
    local_umask=022
    port_enable=YES
    hide_ids=YES
    log_ftp_protocol=YES
    syslog_enable=YES
    ftpd_banner=ArchServ Repo
    ls_recurse_enable=YES
    use_localtime=YES
    pasv_enable=YES
    pasv_promiscuous=YES
    I can't seem to connect to the server however.  I get a 421 Service not available message whenever i try.   Has one gotten anonymous login to work with vsftpd or just getting the service to work in general?  It could be because of my config file that is causing the problem but i've read browse though alot of forums on this topic and their conf file seem similar to mine.  Any help would be great.
    Thanks,
    Vincent

    in the end i just couldn't get vsftpd working so i removed it and went with bftpd and got it working after only a few minutes of tinkering with the config file for my settings.  4 mins w/ bftpd vs. 3 days w/ vsftpd (and it didn't work)...hahahaha, anyway my small local mirrror is now working awesomely for the four systems on my network.  Next goal: create a webserver to host a family genealogy page/project that my dad ask me to help him create.
    Thanks for the help,
    Vincent

  • Can't get Mail working properly

    I just got my new MacPro this week, and it's really great except for I can't get Mail working right. I've set up my accounts and a few emails come through, though not many, and because it's been a week since I've been online, there should be many more than that. Also, I can't send any emails at all, no matter what I do. They will eventually go into my Sent box, but I've been sending them to myself to see if it's working, and they never come through. I spent an hour on the phone yesterday with the tech support for my ISP, and they told me that I'd have to talk to the Apple techs because they didn't have current info for *Mail 3.1*, the version I have, that the latest they had was for 2.something. So I called the Apple tech support and spent 2 hours on the phone with them, and they weren't able to help me get it going correctly either. It keeps giving me error messages such as Connection Failed, or Unable to Receive Mail, saying "there may be a problem with the mail server or network" and that "the connection to the server on ... port has timed out." I'm on DSL and am always online, so I know it's not the internet connection that's the problem. Can anybody give me some advice on what I should try? Any help will be gratefully appreciated!

    Is your ISP Verizon, Demon, or Glocalnet, then it might be Apples biggest Leopard Bug in conjunction with these ISP:s POP-servers.
    The one that randomly changes the settings in "advanced" from "password" to "APOP".
    The visual result of this bug is that you will get a popup-box where Mail asks you to enter your password. (Which is useless entering, since the preference settings are changed.)
    My advice counts only when you are supposed to use "password" as the correct setting in "Advanced" and in conjunction with some ISP:s.
    Michael

  • Can't get webutil working on AS

    Hi All,
    As topic, I can't get webutil working on the application server. I can run individual forms or sessions that do not utilise webutil. As soon as I have baseHTMLjinitiator/baseHTMLjpi/baseHTML defined in the bit of the formsweb.cfg that I am using, I get this problem. The webutiljini.htm etc are located in the forms/server directory as they should be.
    I've got it working fine on my 10.1.2 developer suite XP platform.
    I've been trying without success on the App Server. Version 10.1.2 under Win2003
    I have been right through the installation instructions several time trying to see what I have missed.
    I have installed version 1.0.6 of webutil and version 1.8 of jacob.
    I try and run the wu_test_106 form, and all I get is "Applet Started" at the bottom of the browser window, and a blank browser window.
    My URL is
    http://10.64.125.51:7778/forms/frmservlet?config=webutil1
    The config in the formsweb.cfg is:
    [webutil1]
    WebUtilArchive=frmwebutil.jar,jacob.jar
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    baseHTMLjinitiator=webutiljini.htm
    baseHTMLjpi=webutiljpi.htm
    baseHTML=webutilbase.htm
    archive_jini=frmall_jinit.jar
    archive=frmall.jar
    lookAndFeel=generic
    form=wu_test_106.fmx
    width=100%
    height=100%
    separateFrame=True
    The other parameters are default. If I try a different form name it makes no difference.
    I've done the other configuration stuff, default.env, signing jar files, etc.
    The java console just shows:
    Oracle JInitiator: Version 1.3.1.22
    Using JRE version 1.3.1.22-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\griggto01
    Proxy Configuration: Manual Configuration
    Proxy:
    Proxy Overrides:
    JAR cache enabled
    Location: C:\Documents and Settings\griggto01\Oracle Jar Cache
    Maximum size: 50 MB
    Compression level: 0
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    Loading http://10.64.125.51:7778/forms/java/frmwebutil.jar from JAR cache
    RegisterWebUtil - Loading WebUtil Version 1.0.6
    Thanks for your help.
    Tony

    Hi Tony,
    Form your post it doesn't look like jacob.jar is being loaded. Can you confirm that you have the following files in the <ORACLE_AS>/forms directory:
    java\
       jacob.jar
       frmwebutil.jar
    webutil\
       d2kwut60.dll
       jacob.dllAlso open up your default.env file and check that
    ORACLE_HOME         -- is correct
    FORMS_PATH            -- has the path where wu_test_106.fmx is located
    WEBUTIL_CONFIG      -- is correct (I've experienced what you describe when this path was invalid)
    CLASSPATH             -- contains frmwebutil.jar
    Regards
    Tom Casserly

  • Can't get my work email to load on my new phone

    I can't get my work email onto my Droid X.   Anyone know the trick? 

    Carl3 wrote:
    I can't get my work email onto my Droid X.   Anyone know the trick? 
    First quesiton I have is do you have authorization to access your work email from your Droid X? Just knowing the email address and password is enough for you to get your personal email, but your employer must approve remote access.
    If it's okay with your employer, you may also need to know the incoming and outgoing email server addresses, the port number, and your username on your employer's email server. If you're not sure what they are, check with your IT admin AFTER you get confirmation that it's okay to get your email.

  • Canon Pixma MG6120 Wireless printer - can't get to work with AirportExtreme

    Canon Pixma MG6120 Wireless printer - can't install mg6100swin104ejs.exe 64 bit wirelss driver on Windows 7 64bit when printer is registered to 10.0.1.X Airport Extreme. Even if I enable Advanced Port Mapping, Printer Sharing the Canon software doesn't recognize the printer if it is registered wirelessly to the Airport Extreme. Canon senior tech support and Apple senior tech support don't know how to help. Any advice for someone who was able to get a Canon Pixma Printer to work with their Airport Extreme from a Windows 7 64bit PC also connected to 10.0.1.X subnet? Your advice is greatly appreciated. The printer once online is pingable at 10.0.1.9 and I can see SD cards and browse photo's just can't get the Canon software to wirelessly activate/install.

    To print from an iPAD using the Lexmark S300 series,you need to download the LexPrint app from this link: LexPrint
    Hope this helps.

  • Australia Post Shipping - Can't get to work

    Hi,
    I have read all the online support docs I can find and I just can't get Australia Post Shipping to work on our site for international orders.
    Everywhere it says:
    Choose your shipping provider
    Enter your account details
    Your customers see real time shipping costs!
    But Australia Post selection doesn't let us enter account details - does anyone know where I enter them?
    (see image at bottom)
    And after I allocated sizing, weights etc to every product it doesn't even look like it even works:
    (see how there are no options to select)
    Does anyone have any ideas on how to get it to actually work? I can't imagine BC would role something like this out if it didn't even work but from all my googling I can't see that anyone actually uses it (or at least comments on using it!)
    Would love any help

    I've try but can't get it working ether, i've download from Aur but when i'm trying to use the PKGBUILD with makepkg
    it telling me
    ==> ERROR: Cannot find the fakeroot binary required for building as non-root user.
    ==> ERROR: Cannot find the strip binary required for object file stripping.
    Last edited by jolejo07 (2013-07-05 01:45:21)

Maybe you are looking for

  • 1st gen iPod Touch does not load completely

    I just recently bought a 4th gen iPod Touch to replace my 1st generation one. The new iPod works fine, but the old one will not boot up. When I press the Wake button, it appears to be loading fine for about 30 seconds, but then it just stops. I know

  • Updated AIR 3.4 SDK beta version to release version, package IPA failed

    my project contains an ANE , and it works fine with previous version , today i updated sdk version to AIR3.4 sdk release , but failed to package IPA  with errors below: ld: warning: -ios_version_min not specificed, assuming 4.0 Undefined symbols for

  • Blob_6i

    hello i have design form by using oracle databse 10g and form builder 6i to insert employee picture in blob field i install developer 6i and patch 14 the picture appear in the form when i choose it from computer(o.s) and also insert in the blob field

  • Log file creation -- BDC

    Hi friends.This is Sudhir . I have a scenario of loading mass vendor data. If in case any error occurs while loading the error record should be created as log file. Do we have any function module to create the log file? Hope your answers will be help

  • HT5312 How do do you reset your Security QUESTIONS on your Apple ID?

    I can't find out how to reset my Security questions!