|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
may i know how to reading the content of external file and displaying it in the body of html document?
my code is as below: <head> <script language="Javascript"> var success function openfile(filename) { statements to open and reading the contents of external file success=1; } </script> </head> <body> <a href="javascript openfile('filename')">Click here</a> <script> if(success==1) { displaying the file content } </script> </body> </html> thanks for your help. |
|
#2
|
|||
|
|||
|
there is no file I/O in javascript.
check here for more info: http://developer.irt.org/script/file.htm [QUOTE]Originally posted by cskoo: [B]may i know how to reading the content of external file and displaying it in the body of html document? |
|
#3
|
|||
|
|||
|
gstrock is correct, JavaScript has no I/O. However, you can do some simple things by assigning text and simple HTML code to a variable in a .js file. For example:
myfile.js******************** var trivial trivial="<body>this is my text</body>" ****************************** In your document, place this in the head: <script src=myfile.js></script> Place this at the appropriate point in your document or write it out to a popup: <script>document.write(trivial);</script> You cannot write a <script></script> tag in this fashion nor can you output anything to file (no I/O, remember?). Russ |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > reading and displaying file content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|