Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

funny problem with javascript

 
Nancy Antony
Ranch Hand
Posts: 145
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I was working with java script. and I wrote the following coe


The output is coming.

First Java Script page then hr then script in body then hr and then hi

The code written in the first script tag is not coming. If I remove the second script tag then only First Java script page written in <h1> tag comes.

I tried in browser as well as in my web app.

how to resolve it and why its coming?

Regards,
Nancy
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removed the wrong answer.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second script is overwriting the first write

Not at all.

Line 5 has a syntax error -angle bracket instead of round bracket-, which you'll find in the browser's error console (which you should check first whenever JavaScript doesn't work the way you expect it to).
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what resource you are learning JavaScript from, but it seems to be a little outdated.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, please update your resources. I don't think I've used document.write() since 1999 or so.
 
Nancy Antony
Ranch Hand
Posts: 145
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you suggest a good resource for learning java script , dhtml and ajax?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like Head First JavaScript as a first book. After that, Flanagan's Definitive is a good resource.
 
Nancy Antony
Ranch Hand
Posts: 145
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic