PrepAway - Latest Free Exam Questions & Answers

which script block will display Hello Joe in the document window after you enter the name Joe?

Assuming the function <body onload=”DisplayName()”> is called, which script block will display
Hello Joe in the document window after you enter the name Joe?

PrepAway - Latest Free Exam Questions & Answers

A.
<script type=”text/javascript”>
function DisplayName(void){
var YourName = window.prompt(“What is your name?”,”Please enter your name”);
document.write(“Hello ” + YourName);
}
</script>

B.
<script type=”text/javascript”>
function DisplayName(){
var YourName = window.prompt(“What is your name?”,”Please enter your name”);
document.write(“Hello ” + YourName);
}
</script>

C.
<script type=”text/javascript”>
function DisplayName(void){
var YourName = document.prompt(“What is your name?”,Please enter your name);
document.write(“Hello ” + YourName);
}
</script>

D.
<script type=”text/javascript”>
function DisplayName(){
var YourName = document.prompt(“What is your name?”,”Please enter your name”);
document.write(“Hello ” + yourname);
}
</script>

Explanation:


Leave a Reply