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

1. Registered User
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

2. 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

3. Hi!

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 { padding: 1em } </style> <script type="text/javascript"> function bindEvents(){ for(i=0; i<arguments.length; i++){ 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

##### 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
•

"

"

## X vBulletin 4.2.2 Debug Information

• Page Generation 0.10152 seconds
• Memory Usage 2,947KB
• Queries Executed 13 (?)
Template Usage (33):
• (1)bbcode_php
• (1)footer
• (1)forumjump
• (1)forumrules
• (1)gobutton
• (3)memberaction_dropdown
• (1)navbar
• (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
Included Files (26):
• ./global.php
• ./includes/class_bootstrap.php
• ./includes/init.php
• ./includes/class_core.php
• ./includes/config.php
• ./includes/functions.php
• ./includes/class_friendly_url.php
• ./includes/class_hook.php
• ./includes/class_bootstrap_framework.php
• ./vb/vb.php
• ./vb/phrase.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_foruminfo
• global_state_check
• global_bootstrap_complete
• global_start
• style_fetch
• global_setup_complete
• 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
• notices_check_start
• notices_noticebit
• process_templates_complete
• friendlyurl_redirect_canonical
• bbcode_fetch_tags
• bbcode_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