aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes funny problem with javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "funny problem with javascript" Watch "funny problem with javascript" New topic
Author

funny problem with javascript

Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

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

Joined: Feb 19, 2008
Posts: 2902
    
    1

Removed the wrong answer.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42951
    
  72
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jan 10, 2002
Posts: 61773
    
  67

Yes, please update your resources. I don't think I've used document.write() since 1999 or so.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

can you suggest a good resource for learning java script , dhtml and ajax?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

I like Head First JavaScript as a first book. After that, Flanagan's Definitive is a good resource.
Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

Thanks Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: funny problem with javascript