Object Stopping All Javascript -


learning javascript , have issue can't seem resolve. created object , couple instances, , did document.write on them. problem is, won't work. further problem is, stops all javascript working. when put in window.alert @ beginning ensure had linked html right, wouldn't work either (but window.alert work when object commented out). care explain i'm doing wrong here?

window.alert("test!!!");  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 = work_car.engine; var seat_type = fun_car.seats; var radio_type = fun_car.theradio;  document.write("i want car " + seat_type + " seats." <br />); document.write("oh, , should have " + engine_type + " , " + radio_type "."); 

the <br /> inside first document.write outside of quotes. throwing errors.

the other issue there no + sign after radio.type.

you should however, using console.log instead of document.write.

if need append html page, should use appendchild


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -