Jump to content

mowais

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by mowais

  1. Can anyone Plz help me in Javascript. I am trying to make a puzzle game in Javascript but it's not running. Here is the coding..

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Puzzle Game</title><style type="text/css">img{position:absolute;}#owais{left:39px;top:44px;}#kalam{left:101px;top:44px;}</style><script type="text/javascript">function puzzle(){  if(document.getElementById('owais').style.left == parseInt(62 + document.getElementById('kalam').style.left))   {	document.getElementById('owais').style.left = '101px';	document.getElementById('kalam').style.left = '39px';   }}</script></head><body><img src="Bair.jpg" width="61" height="60" alt="Bair1" id="owais" onclick="puzzle();"/><img src="Bair2.jpg" width="61" height="60" alt="Bair2" id="kalam"/></body></html>

    Plz Help me about this coding..When i given this condition out of if it is running..

  2. Hey.. :rolleyes: I hope you All Good.. I am trying to make a program in javascript but it was not running..Plz find the mistake.. Here is the coding..

    <html><head><title>Game</title><script type="text/javascript">var a=0;function ans(a)  {  if(a==10)   {    alert("Congratualtion !! You have Won 1000 Rupees");    return true;   }  else   {    return false;   }   }</script></head><body><script language="javascript">document.write("<div><h1>Aik ODI mein aik bowler maximum kitne over krwa sakta hai?</h1></div>");document.write("<div><h3>5</h3></div>");document.write("<div><h3>8</h3></div>");document.write("<div onClick='ans(10)'><h3>10</h3></div>");document.write("<div><h3>2</h3></div>");if(ans(a)== 1){document.body.innerHTML="";   document.write("<div><h1>Aik T-20 mein aik bowler maximum kitne over krawa sakta hai?</h1></div>");   document.write("<div><h3>6</h3></div>");   document.write("<div><h3>8</h3></div>");   document.write("<div><h3>10</h3></div>");   document.write("<div><h3>12</h3></div>");   }</script></body></html>

    It is not running after if condition first Question is running but the second one is not running plz Help me... I'll be very thankful to you all... :Pleased:

  3. Yeh Well Said by Don E Also according to my understanding window.close() only works when a new window has been already opened. Is there any other option to close the browser if any one click on the wrong <div>. I means close tab and exit from the browser. If anyone knows plz post here.. Thanx all for reply and help me..

  4. Why do you think you need javascript? Unless you already know JS, you probably should just use forms with php and mysql if there's data to save, There's nothing about your situation that says youshould use JS unless that's the way you want to do it. I have a feeling that you're going to want/need to save user input, in which case, JS would be a distraction right now especially if you're new to coding.
    Thank. It means i can't do it right now. I should try this later..
  5. Simple of My HTML Program that i want. HTML Code

    <html><head></head><body><div class="question"><h1>What is Your Name?</h1></div><div class="trueans"><h3>Owais</h3></div><div class="falseans"><h3>Zeeshan</h3></div><div class="falseans"><h3>Samad</h3></div><div class="falseans"><h3>Shehrose</h3></div></body></html>

    I want that if i click on 'Fine' then it asked second question of mine that i'll give otherwise close the program if anyone click on 'falseans'... And want to do this using javascript bcz i am learning it... Can i do this..

    <script type="text/javascript">if(document.div.trueans == 'clicked'){return true;}else if(document.div.falseans == 'clicked'){window.close();}</script>

    I know that javascript is wrong bcz i don't know how to return a process to the body again.. I hope u understand what i want..

  6. Thnx all for reply .. But i don't understand because i am learning javascript and i want to do with only simple method.. I don't know how use call back and what is this... If there is any other Method plz share....

  7. Hey Every One... :rolleyes: This is my first post in this forum.. I wants help in if condition....I have a two <div> in body and I want that if i click on a one <div> then program runs forward and if i click on a second <div> then program close and exit from the browser..How can i do this Plz Help me.... I'll be very thankful to you... :)

×
×
  • Create New...