| | |
Simple external.js problem
Please support our JavaScript / DHTML / AJAX advertiser: 50% off 6 Months Dedicated Server Hosting from 1&1!
Thread Solved |
•
•
Join Date: Feb 2009
Posts: 8
Reputation:
Solved Threads: 0
I am a new JavaScript user. My teacher told me to display my name using javaScript i solvd it using (document.write) command. and then saving it in(.HTML) format.Now my teacher told me to do the above problm using an external .js file. Plz someone help me to solv this problem. My book provides very few infro about .js or external .js.
Ok you wil need to create a flat file and name it as myname.js then save it in the same directory along with your (x)html document.
Here's the code for myname.js:
Now incorporate it with your (x)HTML document:
Here's the code for myname.js:
javascript Syntax (Toggle Plain Text)
function printMyName() { document.write('Your name!'); }
html Syntax (Toggle Plain Text)
<html> <head> <title>Your title</title> <script type="text/javascript" src="./myname.js"></script> </head> <body> <p><script type="text/javascript"> // Now let's call the function on the external .js printMyName();</script></p> </body> </html>
Last edited by essential; Mar 5th, 2009 at 8:51 am.
![]() |
Similar Threads
- Simple include problem (PHP)
- A simple question about istrue of Ant. (Java)
- Backup: External USB Disks or NAS storage? (Storage)
- Strange Problem - Acer Inspire 3100 - Very Puzzling! (Troubleshooting Dead Machines)
- Files Missing with Maxtor One Touch II USB 200GB External HDD (Storage)
- Start up disc problem (OS 7 / 8 / 9)
- Call a external js function into another js function (JavaScript / DHTML / AJAX)
- Create View syntax problem (Oracle)
- Simple array/class problem (dot operator)??? (C++)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: even cancellation in iframe
- Next Thread: advertisement
Views: 779 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ad ajax ajaxcode ajaxhelp alert alignment animate array asp boarder box boxes bug card catch character close code codingproblem content cookies css database debug dependent design dialog div dom download draganddrop dynamic editor element embed engine error eventhandlers explorer ext file firefox firehose flash focus font form forms function gears google hide html iframe image image() internet internet-explorer java javascript javascripts jquery js jump libcurl lists maps modal mysql onclick onmouseover parameters pdf php player popup position post resize script scroll scrubber search select show size smarty solutions source text twitter unicode validation variables web web-development webkit window xml \n






