Script Categories

Games >>> Ask Mustafa.

We've captured the spy Mustafa from the Austin Powers movie. Mustafa will refuse to answer any question you ask. Except, he hates hearing the same question three times in a row. Ask him a question three times in a row and he will answer you.

Ask Mustafa

Your Question:

Mustafa's Reply:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var refusalarray = new Array(
"I'll Never Tell You!",
"I spit at the question!  Pptt!",
"Go To Hell, Powers!",
"I will take it to the grave with me!",
"Kiss my ass!",
"You can torture me if you like, I will never tell!",
"I will never tell you!",
"I cannot tell you!",
"My lips are sealed shut, you can't open them!"
); // No comma after last item on line above!

var answerarray = new Array(
"Damn, three times.  Yes! That's the answer!",
"No way.  There's your answer, you happy now?",
"Maybe.  Are you satisfied?",
"Yes, yes, of course!",
"Without a doubt!",
"Yeah, I think so.",
"Probably, why do you care though?"
); // No comma after last item on line above!
var num1, num2, tries = 0;

function ask(frm) {
if (frm.question.value == "") {
alert("Please type your question.");
return "";
rand1 = Math.round( (refusalarray.length - 1) * Math.random());
rand2 = Math.round( (answerarray.length - 1) * Math.random());
switch (tries) {
case 1 :
case 2 : return refusalarray[rand1];
case 3 : return answerarray[rand2];
case 4 : tries = 0;
         frm.question.value = frm.answer.value = "";
return "";
//  End -->
h2>Ask Mustafa</h2>
<form name=mustafaform>
Your Question:  <input type=text name=question size=50>
<input type=button value="Ask Mustafa" onClick="this.form.answer.value = ask(this.form);">
Mustafa's Reply: <input type=text name=answer size=50>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).