![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Can anyone give me a "Hello Earth!" in JS?
|
|
|
|
|
|
#2 |
|
Programmer
|
<script language="JavaScript" type="text/JavaScript">
document.write("Hello Earth!");
alert("Hello Mars!");
document.getElementById('helloDiv').innerHTML = "Hello Pluto!";
</script>
<br>
<div id="helloDiv"></div>
__________________
I can pick my friends. And I can pick my nose. So, why can't I pick my friend's nose? |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Remember that document.write doesn't work in XHTML though - don't ask me why.
|
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Quote:
Now let's bring in a little of Peter Schilling's Major Tom song! |
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Oooh... just noticed an error. Not an important one, but an error all the same. In the type attribute (not the language attribute) of the <script> tag, "JavaScript" should be in lowercase.
|
|
|
|
|
|
#6 | |
|
Programming Guru
![]() |
Quote:
document.write = function(str) { document.outerHTML += str; }Btw the language attribute of script is deprecated, to keep up with standards use... <script type="text/Javascript">
//<![CDATA[
/* .. your code here .. */
//]]>
</script>
__________________
Last edited by tempest; Feb 20th, 2005 at 5:33 PM. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|