Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<html>
<head>

</head>
<body>
<div id='feedback' onClick='goodbye()'>Users without Javascript see this.</div>
<script type='text/javascript'>

document.getElementById('feedback').innerHTML='Hello World!';
function goodbye() {
    document.getElementById('feedback').innerHTML='Goodbye World!';
}

</script>
</body>
</html>


this was my question see the div part i have called the function goodbye() now what happens????
Posted
Updated 5-Jul-11 19:07pm
v9
Comments
Christian Graus 6-Jul-11 0:32am    
I deleted where you asked this again. Please ask each question only once.
aarif moh shaikh 30-Sep-15 8:37am    
it work properly (i think).. what is your main problem??

getelementbyid is not proper work
 
Share this answer
 
Comments
Christian Graus 6-Jul-11 0:32am    
Yes, he spelled it right and I assumed he'd know what I meant.
What user could possibly not have javascript ? You can put your js code in a CDATA block if you want to hide the code from a browser that does not have js. If they don't have js, the function won't be called. The method is broken, b/c you call getelementbyid without specifying an id.
 
Share this answer
 
I fixed formatting in the question and tested the sample. Now it works properly: displays "Hello World!" on load and "Goodbye World!" on click, as probably it was designed.

It's hard to say, what was wrong: the HTML document itself or presentation of its source code in HTML of CodeProject. At least I can tell that the formatting was screwed up.

My question is: what was the question? It works, and it works properly, as intended.

—SA
 
Share this answer
 
I deleted where you asked this twice more and moved your code in here. EDIT your post, don't flood the forums.

The text should change to 'goodbye', I guess. What IS happening ? Why are you asking this ? What are you trying to do ?
 
Share this answer
 
Comments
Eva Liyana 6-Jul-11 0:46am    
actually i need to know what will be toutput for this question i askd. i am getting Helloworl .so i was asking what will be happening to the goodbyeworld when that fub=nction will call......?????



Users without Javascript see this.

/*document.getElementById('feedback').innerHTML='Hello World!';
remove this coode*/
function goodbye() {
document.getElementById('feedback').innerHTML='Goodbye World!';
}



 
Share this answer
 
Comments
CHill60 30-Sep-15 6:45am    
Why answer a question that is over 4 years old and already has solutions. More to the point you removed the "Hello World" from the load and have not answered the OP's actual (very unclear) question.
Avoid doing this, you will only attract downvotes and reports

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900