www.webdeveloper.com
Results 1 to 3 of 3

Thread: What is the function codes for "IF"?

  1. #1
    Join Date
    Sep 2003
    Posts
    47

    What is the function codes for "IF"?

    **Note sign ">" means greater than.


    IF "GRT" > 40000, "Port dues" will show result 175,
    IF "GRT" > 20000, "Port dues" will show result 140,
    IF "GRT" > 10000, "Port dues" will show result 105,
    IF "GRT" > 5000, "Port dues" will show result 80,
    IF "GRT" > 2000, "Port dues" will show result 60,
    IF "GRT" > 1000, "Port dues" will show result 40,
    IF "GRT" > 75, "Port dues" will show result 25


    Link: http://www.oceanbulk.com.sg/maths.html

  2. #2
    Join Date
    Nov 2003
    Location
    Aachen, Germany
    Posts
    4,090
    Hi!

    function calcValue(){
    dues=document.getElementById('j');
    val=Number(getEl('a').value);
    if(val>40000)dues.value=175
    else if(val>20000)dues.value=140
    else if(val>10000)dues.value=105
    else if(val>5000)dues.value=80
    else if(val>2000)dues.value=60
    else if(val>1000)dues.value=40
    else if(val>75)dues.value=25
    document.getElementById('total').value = Number(getEl('a').value) + Number(getEl('b').value) + Number(getEl('c').value) + Number(getEl('d').value) + Number(getEl('e').value) + Number(getEl('f').value) + Number(getEl('g').value) + Number(getEl('g').value) + Number(getEl('i').value) + Number(getEl('j').value) + Number(getEl('k').value) + Number(getEl('l').value);
    }

    Cheers - Pit
    The perfect website, which isn't one: http://www.pit-r.de (completely re-designed)

    Bad news for many "important" members here: I am still alive.

  3. #3
    Join Date
    Nov 2003
    Location
    Aachen, Germany
    Posts
    4,090
    Hi!

    In reply to your pm:
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <
    html>
    <
    head>
    <
    title>AGENCY PROFORMA FOR VESSEL CALL SINGAPORE FOR BUNKERING AT ANCHORAGE::MARS Shipping Trading</title>
    <
    meta http-equiv="content-type" content="text/html; charset=utf-8">
    <
    style type="text/css">
    fieldset padding1em }
    </
    style>
    <
    script type="text/javascript">
    function 
    bindEvents(){
    for(
    i=0i<arguments.lengthi++){
    arguments[i].onkeydown calcValue;
    arguments[i].onkeyup calcValue;
    }
    }
    function 
    getEl(id) { return document.getElementById(id) }
    function 
    calcValue(){
    document.getElementById('j').value Number(getEl('a').value) / 100;
    dues=document.getElementById('k');
    val=Number(getEl('a').value);
    if(
    val>40000)dues.value=175
    else if(val>20000)dues.value=140
    else if(val>10000)dues.value=105
    else if(val>5000)dues.value=80
    else if(val>2000)dues.value=60
    else if(val>1000)dues.value=40
    else if(val>75)dues.value=25
    else if(val<=75)dues.value=0//do not know, if you need this
    document.getElementById('total').value Number(getEl('a').value) + Number(getEl('b').value) + Number(getEl('c').value) + Number(getEl('d').value) + Number(getEl('e').value) + Number(getEl('f').value) + Number(getEl('g').value) + Number(getEl('g').value) + Number(getEl('i').value) + Number(getEl('j').value) + Number(getEl('k').value) + Number(getEl('l').value);
    }
    onload = function(){
    bindEvents(getEl('a'), getEl('b'), getEl('c'), getEl('d'), getEl('e'), getEl('f'), getEl('g'), getEl('h'), getEl('i'), getEl('j'), getEl('k'), getEl('l'));
    }
    </
    script>
    </
    head>
    <
    body>
    <
    form action="#">
    <
    fieldset>
    <
    legend>AGENCY PROFORMA FOR VESSEL CALL SINGAPORE FOR BUNKERING AT ANCHORAGE</legend>
    <
    dl>
    <
    dt><label for="a">GRT:</label></dt>
    <
    dd><input type="text" id="a"></dd>
    <
    dt><label for="b">Agency fee for first 48 hours</label></dt>
    <
    dd><input type="text" id="b"></dd>
    <
    dt><label for="c">Every subsequent day after 48 hours</label></dt>
    <
    dd><input type="text" id="c"></dd>
    <
    dt><label for="d">TLX/Fax/Ship call</label></dd>
    <
    dd><input type="text" id="d"></label></dd>
    <
    dt><label for="e">Agent transport fee</label></dt>
    <
    dd><input type="text" id="e"></label></dd>
    <
    dt><label for="f">Crew change (excluding transport/hotel/boat chanrge &#8212; if any)</label></dd>
    <dd><input type="text" id="f"></dd>
    <
    dt><label for="g">Agency service boat</label></dt>
    <
    dd><input type="text" id="g"></dd>
    <
    dt><label for="h">Cash to master expenses</label></dt>
    <
    dd><input type="text" id="h"></dd>
    <
    dt><label for="i">DOCUMENT SPARE PARTS</label></dt>
    <
    dd><input type="text" id="i"></dd>
    <
    dt><label for="j">PORT DUES FOR FIRST 24 HRS</label></dt>
    <
    dd><input type="text" id="j"></dd> <font color=red><b>This is the one...</b></font>
    <
    dt><label for="k">NMB FEE</label></dt>
    <
    dd><input type="text" id="k"></dd>
    <
    dt><label for="l">PILOTAGE IN OUT</label></dt>
    <
    dd><input type="text" id="l"></dd>
    </
    dl>
    <
    hr>
    <
    label for="total">Total:</label>
    <
    input type="text" id="total" value="0">
    <
    input type="reset">
    <
    INPUT TYPE="button" VALUE=" Print Page " onclick="javascript:window.print()">
    </
    fieldset>
    </
    form>
    </
    body>
    </
    html
    Was it that, what you need??

    Cheers - Pit
    The perfect website, which isn't one: http://www.pit-r.de (completely re-designed)

    Bad news for many "important" members here: I am still alive.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.44191 seconds
  • Memory Usage 2,947KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates