File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes display text string with Javascript on screen 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 "display text string with Javascript on screen" Watch "display text string with Javascript on screen" New topic
Author

display text string with Javascript on screen

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
How to display text string with Javascript on screen?

This is my test page:

I saw only "test docwrite(2);".
I want to see "test 1 hi hello docwrite(2);" with " 1 hi hello" coming from Javascript.
How to do that?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30370
    
150

Alberto,
First of all, that HTML is malformed. It is missing body tags. With malformed HTML, all bets are off as to what will happen.

If you were to add the body tags, you would run into a second problem. docwrite is called before it is defined. As a result, JavaScript doesn't know anything about a docwrite function. The JavaScript is ignored but doesn't run.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display text string with Javascript on screen