Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Can anyone help me with this , learning javascript from a book i got from the library?
What am i doing wrong this is objects which i am now on thanks for all your help in advance
ian
<hmtl>
<head>
<script language="javascript">
<--!
function car(seats,engine,theradio)
{
this.seats=seats;
this.engine=engine;
this.theradio=theradio;
}
var work_car=new car ("cloth", "v-6", "Tape Deck");
var fun_car=new car("leather", "v-8", "CD player");
var engine_type=fun_car.engine;
var seat_type=fun_car.seats;
var radio_type=fun_car.theradio;
//-->
<script>
</head>
</body>
<script language="javascript">
<--!
document.write("I want a car with "+seat_type+" seats.<br>");
document.write("It also needs a "+engine_type+" engine.<br>");
document.write("Oh, and I would like a "+Radio_type+" also.");
//-->
</script>
</body>
</html>
changed all what you said , but to no avail thanks for all your info, appreciated, typos etc but still not working thanks ian
changed all what you said , but to no avail thanks for all your info, appreciated, typos etc but still not working thanks ian
1 Answer
- Anonymous9 years agoFavorite Answer
I can see a few typos, but the syntax looks correct.
The html opening tag is mis-typed.
The closing tag for your first script block is missing its slash.
You have two different variables: radio_type and Radio_type. I expect you only meant to have radio_type. Javascript is case-sensitive.
It's always the little things.