/    Sign up×
Community /Pin to ProfileBookmark

SelectIndex and Framset

Hi

I am working on a small project whereby I am create a select index in the top of a frame (I guess that’s the correct terminology). Here is my code:

Test.html
<HTML><HEAD><TITLE>Test</TITLE>
<SCRIPT language=javascript>
function selCar(){
var cars = new Array()
var car_select = document.getElementById(“selectCar(this.form)”)

cars[0] = “Holden”
cars[1] = “Ford”
cars[2] = “Mercedes”

for(i=0;i<cars.length;i++){
eval(“document.fmCar.selectCar.options[i]=” + “new Option(‘”+cars[i]+”‘,'”+cars[i]+”‘)”)
}

}
</script>
</head>

<frameset rows=”100,*” frameborder=”no” border=”0″ framespacing=”0″>
<frame src=”topCar.html” name=”topFrame” scrolling=”No” noresize=”noresize” marginwidth=”0″ marginheight=”0″ id=”topFrame” />
</frameset>
<noframes><body>
</body>
</noframes></html>

topcar.html
<HTML>
<body >
<table width=”760″ border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”borderPage”>
<tr>
<td class=”pageTitle”>Cars </td>
</tr>
<tr>
<td valign=”bottom” class=”content”>
<form name=”fmCar” id=”fmCar” method=”post” action=””>

<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”2″>
<tr>
<td><strong>Select Car:</strong>
<select name=”selectCar” id=”selectCar”>
<option>–Select Car–</option>

</select>
<input name=”btnShowCar” type=”button” id=”btnShowCar” value=”Show Car Info” onclick=”selectCar(this.form)”/> </td>
<td align=”right”>
<input name=”btnSetDefaultCar” type=”button” id=”btnSetDefaultCar” value=”Save this Car as your Default Car” onclick=”setDefaultCar(this.form)”/>
</td>
</tr>
</table>
</form>
</td>

</tr>
</table>
</body>
</html>

For some reason it doesn’t like =”selectCar(this.form)”. Could some suggest an alternative way of doing it.

Regard

Greg

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @gregc_ 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.13,
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,
)...