home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
js
/
ComboBox.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
2KB
|
79 lines
// Copyright (c) 2003 Electronic Arts Inc. All rights reserved.
var oGameFace = window.external.GameInterface;
var oAudioInterface = oGameFace.AudioInterface;
function ComboBox(id, x, y, width, height, dropHeight, divId, isUp)
{
this.id = id;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.dropHeight = dropHeight;
this.isUp = isUp;
this.write(divId);
};
ComboBox.prototype.write = function (divId)
{
var s = "";
s += "<DIV id='' style='DISPLAY: inline; OVERFLOW: hidden; CURSOR: hand;' tabIndex='-1' noWrap>";
s += "<SPAN onmouseleave='" + this.id + " .OnMouseLeave()'>";
s += "<OBJECT ID='" + this.id + "' CLASSID='CLSID:A656E343-CDF7-4BB3-BE94-2FBB1D993BD0' style='position:absolute;width:" + this.width + "px;height:" + this.height + "px;top:" + this.x + "px;left:" + this.y + "px;'>";
s += "</OBJECT></SPAN></DIV>";
s += "<SCRIPT LANGUAGE='javascript' FOR='" + this.id + "' EVENT='DropDown()'>";
s += "comboBoxOnDropDown('" + this.id + "', " + this.height + ", " + this.x + ", " + this.isUp + ")";
s += "</SCRIPT>";
s += "<SCRIPT LANGUAGE='javascript' FOR='" + this.id + "' EVENT='PullUp()'>";
s += "comboBoxOnPullUp('" + this.id + "', " + this.height + ", " + this.x + ")";
s += "</SCRIPT>";
var divComboBox = document.getElementById(divId);
divComboBox.innerHTML = s;
};
ComboBox.prototype.addString = function (str)
{
var drpObj = document.getElementById(this.id);
drpObj.AddString(str);
};
function comboBoxOnDropDown(id, height, x, isUp)
{
oAudioInterface.PlaySFX(1095);
var drpObj = document.getElementById(id);
if (drpObj.Lists < 6)
{
drpObj.style.height = height*(drpObj.Lists+1);
}
else
{
drpObj.style.height = height*(7);
}
var nHeight = parseInt(drpObj.style.height);
if (isUp)
{
drpObj.style.top = x + height - nHeight;
drpObj.SetListUp(1);
}
drpObj.style.zIndex = 100;
}
function comboBoxOnPullUp(id, height, x)
{
var drpObj = document.getElementById(id);
drpObj.style.height=height;
drpObj.style.pixelTop = x;
drpObj.style.zIndex=0;
}