/    Sign up×
Community /Pin to ProfileBookmark

Help with a script

I am a complete newbie when it comes to java script. I am wanting to copy a drop down script. Well I geuss thats what I would call it.

Here is a link to the page with the script

[url]http://nextelonline.nextel.com/NASApp/onlinestore/en/Action/DisplayPhones?audience=INDIVIDUAL&id12=Personal_Wireless;Phones[/url]

Where it says full features, included accessories ect. and when you click them a box drops down and the arrow points down.

I am wanting the exact same thing can some please post the code for me.

Thank-you.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@NedalsSep 25.2005 — I wrote this back in the year 'dot'.....

It's unmodified and may not be cross-browser valid, but it will give you a starting point.

Happy coding ?
<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Expanding Menu&lt;/title&gt;

&lt;script language="JavaScript"&gt;
&lt;!--
var DDok = ((document.layers) || (document.all));
if (DDok) {
document.write("&lt;script language='JavaScript1.2' src='exptestlist.js'&gt;&lt;/script&gt;");
document.write("&lt;script language='JavaScript1.2' src='expscript.js'&gt;&lt;/script&gt;");
}
//--&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;body onLoad="expand()"&gt;
&lt;h2&gt;Expanding Menu&lt;/h2&gt;
&lt;div id="emenu" style="position:absolute"&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


These are the external javascript files...

exptestlist.js - the menu items (add menus, 'armX' and items as needed)
<i>
</i>arx = new Array(100,20,15); //top, left, imgwidth+5

arm1 = new Array(
0,"COMPANY","blank10.html",
"Welcome","blank11.html",
"Company Background","blank12.html"
)

arm2 = new Array(
0,"PRODUCT","blank20.html",
"Widgets","blank21.html",
"Components","blank22.html"
)


expscript.js - The main script
<i>
</i>var NS = (document.layers) ? true : false;

function expand(menu,dir) {
NS ? menuTBL = eval(document.emenu) : menuTBL = eval(document.all.emenu);
if (menu) {
NS ? menuTBL.visibility = 'hide' : menuTBL.style.visibility = 'hidden';
currAry = eval('ar'+menu); currAry[0] = dir;
}
build();
if (NS) { menuTBL.document.write(menustr); menuTBL.document.close(); }
else { menuTBL.innerHTML = menustr; }
NS ? menuTBL.pageY = arx[0] : menuTBL.style.pixelTop = arx[0];
NS ? menuTBL.pageX = arx[1] : menuTBL.style.pixelLeft = arx[1];
NS ? menuTBL.visibility = 'show' : menuTBL.style.visibility = 'visible';
}

function build() {
menustr = '&lt;table cellpadding=0 cellspacing=0 border=0&gt;n';
menustr += '&lt;tr&gt;&lt;td width='+arx[2]+'&gt;&lt;/td&gt;&lt;/td&gt;&lt;td width=10&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;n';
i = 1;
while (eval('window.arm' + i)) {
currAry = eval('arm' + i);
if (currAry[0]) {
menustr += '&lt;tr&gt;&lt;td&gt;&lt;a href="javascript:expand('m'+i+'',0)" onMouseOver = "status=''; return true"&gt;&lt;img src="true.gif" border=0&gt;&lt;/a&gt;&lt;/td&gt;';
menustr += '&lt;td colspan=2&gt;&lt;a href="'+currAry[2]+'" class="expbar"&gt;'+currAry[1]+'&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
jmax = (currAry.length-3)/2
for (j=0; j&lt;jmax; j++) {
menustr += '&lt;tr&gt;&lt;td colspan=2&gt;&lt;/td&gt;&lt;td&gt;&lt;a href="'+currAry[(j*2)+4]+'" class="expbar"&gt;'+currAry[(j*2)+3]+'&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
}
} else {
menustr += '&lt;tr&gt;&lt;td&gt;&lt;a href="javascript:expand('m'+i+'',1)" onMouseOver = "status=''; return true"&gt;&lt;img src="false.gif" border=0&gt;&lt;/a&gt;&lt;/td&gt;';
menustr += '&lt;td colspan=2&gt;&lt;a href="'+currAry[2]+'" class="expbar"&gt;'+currAry[1]+'&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;';
}
i++;
}
menustr += '&lt;/table&gt;';
return menustr;
}
Copy linkTweet thisAlerts:
@darkcarterauthorSep 26.2005 — so how would I go about installing this script?
Copy linkTweet thisAlerts:
@NedalsSep 26.2005 — The top script is the HTML page. Copy and paste this into an HTML file with a name of your choosing. The only content is the expanding menu which is contained by the 'emenu' div. It uses 2 external javascript files.

Copy and paste the code of the second and third sections and put the content into two files, 'exptestlist.js' and 'expscript.js' respectively.

Put all 3 files in the same directory, and open the HTML file in your browser and you should have an expanding menu the work with.
×

Success!

Help @darkcarter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...