/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Any ideas how to change?

Fellow Forum-ers:

I have the following HTML file

[code=php]
<html>
<head>
<title>Web Scheduling</title>
<script type=”text/javascript” src=”Faculty.js”></script>
</head>
<body>

Currently Selected:
<br /><input id=”FacultyName” type=”text” value=””> Faculty Name
<input id=”SiteName” type=”text” value=””> Site Name
<input id=”Comment” type=”text” value=””> Comments
<p />

<script type=”text/javascript”>
ListFacultyNames();
</script>

</body>
</html>
[/code]

That calls this ‘Faculty.js’ file

[code=php]
// Faculty Names
var FacultyNames = new Array (
“Amster”,
“Bade”,”Bacigalupi”,”Bartuccio”,”Bejar”,”Besada”,”Black”,”Burns”,
“Calderon”,”Caputo”,”Crandall”,”Coulter”,
“Davis”,”Dufek”,
“Espejo”,
“FAB”,”Falco”,”Fecho”,”Frauens”,
“Gorman”,”Gonzalez”,
“Hunter”,
“Janoff A.”,
“Kabat”,
“Leasher”,
“Najman”,”Nelson”,”Neiberg”,”Nguyen TL”,”Nguyen Thy”,
“Oliver”,
“Patrick”,”Patterson”,”Pearl”,”Pham”,”Pizzimenti”,
“Reed”,
“Resident”,”Resident-CL”,”Resident1″,”Resident2″,”Resident3″,
“Reynolds”,”Rodena”,”Rodman”,”Rouse”,”Rumsey”,
“Saitowitz”,”Schatz”,”Schinas”,”Seger”,”Shechtman”,”Sowka”,
“Taub”,”Tyler”,
“Vollmer”,
“Wagner”,”Woodruff”,”Woods”
)

function ListFacultyNames() {
document.write(‘<select name=”FacultyList”>’);
for (var i=0; i<FacultyNames.length; i++) {
document.write(‘<option value=”‘+FacultyNames[i]+'” />’);
}
document.write(‘</select>’);
}
[/code]

But it doesn’t create the <select> list.

Any ideas what to change to make it work? ?
I put an ‘alert(FacultyNames[i])’ in the function ‘ListFacultyNames()’ for..loop, and all names appear.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@tabzterAug 07.2006 — function ListFacultyNames() {

document.write('<select name="FacultyList">');

for (var i=0; i<FacultyNames.length; i++) {

document.write('<option value="'+FacultyNames[i]+'" />'[B]+FacultyNames[i][/B]);

}

document.write('</select>');

}



try that
Copy linkTweet thisAlerts:
@gil_davisAug 07.2006 —  document.write('&lt;option value="'+FacultyNames[i]+'" /&gt;'[color=red] + FacultyNames[i][/color]);
Copy linkTweet thisAlerts:
@JMRKERauthorAug 07.2006 — Duh.... :o

Thanks a bunch "tabzter". ?

I just wasted about 10 minutes writing, debugging and failing to see the obvious. :eek:

Works just like I "planned"! ?
Copy linkTweet thisAlerts:
@JMRKERauthorAug 07.2006 — Thanks 'gil davis' as well. ?

You guy respond faster that I can type. :o
×

Success!

Help @JMRKER 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...