Client Side Script Examples

Included below are some examples of hand-coded client side (browser) application logic created.

*** JAVASCRIPT FUNCTIONS – MANIPULATES FORM DATE VALUES FOR UPDATING DATABASE

function AddDateTime() {
var DayTimeTotal = “”;
var DayTimeTotal = document.ToolTest.Date_Menu.value + document.ToolTest.starttime.value + document.ToolTest.starttimezone.value;
var GetTime = document.ToolTest.starttime.value;
var GetTz = document.ToolTest.starttimezone.value;
if (DayTimeTotal.length > 0) {
}
}
function textValue() {
var DisplayInteger, DisplayString = “”;
DisplayInteger=document.ToolTest.starttime.selectedIndex
DisplayString=document.ToolTest.starttime.options[DisplayInteger].text
if (DisplayString.length > 0) {
document.ToolTest.DisplayText.value = “Value is ” + DisplayString +”!”
}
}
// End –>
*** VBSCRIPT FUNCTION – MANIPULATES FORM DATE VALUES FOR PASSING TO JAVASCRIPT
Function AddMins

Dim TheForm, GetHr, GetMin, GetTZ, AddTZ, AddTMins, SetGameTime, Test

‘ Set TheForm = Document.forms(“form1”)
GetHr = CInt(Document.form1.startHr.Value) ‘ i.e. 3 PM = 15
GetMin = Document.form1.startMin.Value ‘ Gets the Minute value i.e. 30
GetTZ = CInt(Document.form1.starttimezone.Value) ‘ i.e. EST = 3
AddTZ = GetHr + GetTZ
AddTMins = AddTZ & “:” & GetMin + “:” & “00”
SetGameTime = TimeValue(AddTMins)
‘ MsgBox(SetGameTime)
Document.form1.PlayTime.value = SetGameTime
End Function

*** JAVASCRIPT – TIMER CODE FOR ONLINE TEST APP – CAPTURE DURATION + FORCING TEST END TIME
 <BODY onload=”startClock(); startTime();”>
<script language=”JavaScript”><!–
var Temp;
var TimerId = null;
var TimerRunning = false;
Seconds = 0
Minutes = 0
Hours = 0

function showtime()
{
if(Seconds >= 59)
{
Seconds = 0
if(Minutes >= 59)
{
Minutes = 0
if(Hours >= 23)
{
Seconds = 0
Minutes = 0
Hours = 0
}
else {
++Hours
}
}
else {
++Minutes
}
}
else {
++Seconds
}

if(Seconds != 1) { var ss=”s” } else { var ss=”” }
if(Minutes != 1) { var ms=”s” } else { var ms=”” }
if(Hours != 1) { var hs=”s” } else { var hs=”” }

Temp = ‘Elapsed Time is ‘+Hours+’ hour’+hs+’, ‘+Minutes+’ minute’+ms+’, ‘+Seconds+’ second’+ss+”
window.status = Temp;
TimerId = setTimeout(“showtime()”, 1000);
TimerRunning = true;
}
var TimerId = null;
var TimerRunning = false;

function stopClock() {
if(TimerRunning)
clearTimeout(TimerId);
TimerRunning = false;
}

function startClock() {
stopClock();
showtime();
}

function stat(txt) {
window.status = txt;
setTimeout(“erase()”, 2000);
}

function erase() {
window.status = “”;
}

function startTime() {
var time = new Date();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();

document.test.t_date.value = ((hours < 10) ? ‘0’ + hours : hours) +
‘:’ + ((minutes < 10) ? ‘0’ + minutes : minutes) +
‘:’ + ((seconds < 10) ? ‘0’ + seconds : seconds);

return;

}

function finishTime() {
var time = new Date();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();

document.test.s_time.value = ((hours < 10) ? ‘0’ + hours : hours) +
‘:’ + ((minutes < 10) ? ‘0’ + minutes : minutes) +
‘:’ + ((seconds < 10) ? ‘0’ + seconds : seconds);
return;
}
/*
function loadDoc() {
// initial focus; use if needed
document.test.First_Name.focus ();
return;

loadDoc();

} */

// –>
</script>

*** ACTIVEXSCRIPT – DUAL CODE TO ENABLE CROSS BROWSER FUNCTIONALITY
 <SCRIPT LANGUAGE=”VBScript”>

sub DemoTxt_MouseDown (Button, Shift, X, Y)
Demo.Visible = -1
DemoTxt.Visible = 0
end sub

sub Demo_MouseDown (Button, Shift, X, Y)
DemoTxt.Visible = -1
Demo.Visible = 0
end sub
</SCRIPT>

<DIV BACKGROUND=”#ffffff” ID=”Demo_alx”
STYLE=”LAYOUT:FIXED;WIDTH:370;HEIGHT:140;”>

<OBJECT ID=”DemoTxt” WIDTH=370 HEIGHT=140
CLASSID=”CLSID:D4A97620-8E8F-11CF-93CD-00AA00C08FDF”
STYLE=”TOP:0;LEFT:0;WIDTH:370;HEIGHT:140;ZINDEX:0;”>
<PARAM NAME=”PicturePath” VALUE=”/gfx/cm_demotxt.gif”>
<PARAM NAME=”BorderStyle” VALUE=”0″>
<PARAM NAME=”SizeMode” VALUE=”3″>
<PARAM NAME=”Size” VALUE=”9807;3704″>
<PARAM NAME=”PictureAlignment” VALUE=”0″>
<PARAM NAME=”VariousPropertyBits” VALUE=”19″>
</OBJECT>
<OBJECT ID=”Demo” WIDTH=370 HEIGHT=140
CLASSID=”CLSID:D4A97620-8E8F-11CF-93CD-00AA00C08FDF”
STYLE=”TOP:0;LEFT:0;WIDTH:370;HEIGHT:140;DISPLAY:NONE;ZINDEX:1;”>
<PARAM NAME=”PicturePath” VALUE=”/gfx/anim_done.gif”>
<PARAM NAME=”BorderStyle” VALUE=”0″>
<PARAM NAME=”SizeMode” VALUE=”3″>
<PARAM NAME=”Size” VALUE=”9807;3704″>
<PARAM NAME=”PictureAlignment” VALUE=”0″>
<PARAM NAME=”VariousPropertyBits” VALUE=”19″>
</OBJECT>
</DIV>

*** JAVASCRIPT / ACTIVEXSCRIPT – DUAL CODED TO SUPPORT CROSS BROWSER FUNCTIONALITY
 <!– section f: navigation tabs –>
<tr><td colspan=8 width=590>&nbsp;</td></tr>
<tr><td width=160 valign=top><nobr><IMG SRC=”../graphics/t_empty85.gif”
ALT=”.” WIDTH=”85″ HEIGHT=”71″ BORDER=”0″><a
href=”/index.htm” onMouseOut=”out(‘home’);” onMouseOver=”over(‘home’)
;”><IMG NAME=”home” SRC=”../gfx/t_home.gif” ALT=”home” WIDTH=”75″
HEIGHT=”71″ BORDER=”0″></a></nobr></td><td width=20 valign=top align=left><IMG
SRC=”/graphics/t_empty20.gif” WIDTH=”20″ HEIGHT=”71″
BORDER=”0″></td><td width=410 colspan=6 valign=top><nobr><OBJECT
CLASSID=”CLSID:812AE312-8B8E-11CF-93C8-00AA00C08FDF” ID = “tab2_alx”
STYLE = “LEFT:0;TOP:0;WIDTH:375;HEIGHT:71;”><PARAM NAME = “ALXPATH”
REF VALUE=”/alx/tab2.alx”><a
href=”../maps/tj_welcome.map” onMouseOut=”out(‘welcome’);”
onMouseOver=”over(‘welcome’)
;”><IMG NAME=”welcome” SRC=”/graphics/t_welcome.gif” ALT=”welcome”
WIDTH=”75″ HEIGHT=”71″ BORDER=”0″ ISMAP></a><a
href=”/maps/tj_nav.map” onMouseOut=”out(‘navigation’);” onMouseOver=”over(‘navigation’)
;”><IMG NAME=”navigation” SRC=”/graphics/t_nav.gif” ALT=”navigation”
WIDTH=”75″ HEIGHT=”71″ BORDER=”0″ ISMAP></a><a
href=”/maps/tj_services.map” onMouseOut=”out(‘services’);” onMouseOver=”over(‘services’)
;”><IMG NAME=”services” SRC=”/graphics/t_services.gif” ALT=”services”
WIDTH=”75″ HEIGHT=”71″ BORDER=”0″ ISMAP></a><a
href=”/maps/tj_news.map” onMouseOut=”out(‘features’);” onMouseOver=”over(‘features’)
;”><IMG NAME=”features” SRC=”/graphics/t_news.gif” ALT=”news” WIDTH=”75″
HEIGHT=”71″ BORDER=”0″ ISMAP></a><a
href=”/maps/tj_cities.map” onMouseOut=”out(‘cities’);” onMouseOver=”over(‘cities’)
;”><IMG NAME=”cities” SRC=”/graphics/t_cities.gif” ALT=”cities” WIDTH=”75″
HEIGHT=”71″ BORDER=”0″ ISMAP></a></OBJECT><IMG
SRC=”/graphics/t_empty35.gif” ALT=”nothing” WIDTH=”35″ HEIGHT=”71″ BORDER=”0″></nobr></td></tr>
*** LINGO – MACROMEDIA SHOCKWAVE (DIRECTOR) APPLET – NFL JAX JAGUARS
 on startmovie
global basejagschannel, basecast, channum, jagdelay, jagpausestate, slowmostatus, voiceintrodelay, endofroto

—the next variable is how many seconds of narration before motion

set voiceintrodelay = 6.2 * 60

—the next variable is the exact last frame of rotoscoping
—this should be exactly one frame prior to “end” label
—and should be the exact frame where the dissolve takes place

set endofroto = 127

—the next variable is where the jaguar sprites start
set basejagschannel = 5
set basecast = 51
set channum = 0
set jagpausestate = FALSE
set slowmostatus = FALSE

global syncstart, jagfps, jagtps, tempocastbase, tempocast
set jagfps=15
set jagtps=60/jagfps
—syncstart is the frame that the force tempo starts in
set syncstart=15
—tempocastbase and tempocast are for the “cylon” tempo indicator graphic
end startmovie


on playeridcheck
global basejagschannel, channum, jagdelay, jagpausestate, jagtps, syncstart
repeat with channel = 0 to 10
set channum = channel
if rollover (basejagschannel + channel) then popnamenumber
end repeat
set jagdelay = jagdelay + 1
if jagdelay > 10 then clearplayerid
if jagpausestate = TRUE then go to the frame
end playeridcheck


on popnamenumber
global basecast, channum, jagdelay
set jagdelay = 0
puppetsprite 44, TRUE
set the membernum of sprite 44 to member(channum + basecast)
updatestage
end popnamenumber—
on tempofaster
global jagtps, jagfps, syncstart, tempocastbase, tempocast
set jagfps = (jagfps*1.33)
if jagfps>35.28 then set jagfps=35.28
set jagtps = 60/jagfps
set syncstart = (the frame)
startTimer
puppetsprite 46, TRUE
set tempocast = tempocast+1
if tempocast >87 then set tempocast = 87
set the membernum of sprite 46 to tempocast
updatestage
end tempofaster


on mouseUp
gotoNetPage “http://www.jaguarsnfl.com/jag_web/team/players/rison_a_x.htm”,”section”
end
global voiceintrodelay
if the timer > voiceintrodelay then go to “playbegin”
playeridcheck
end