Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 25th, 2005, 05:26 AM
navajes123 navajes123 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: goa,india
Posts: 68 navajes123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to navajes123
a TEASER 4 U ALL

hi friends, gud morning, well i have a simple query 2 ask u.
look i have a script that displays a question to a user along with 3 answers from which he has to choose one.
once he chooses an answer and clicks on submit button, he gets a message whether it is correct or not. also the next question appears.all this works fine.
but incase the user doesnt choose any answer and clicks the submit button, i awnt that he should get an javascript alert box to popup saying he should choose one answer . And only on choosing an answer should the next question appear.
kindly tell me how this can b done. i am sending the extract of my script.waiting for a solution very badly.plz help


php Code:
Original - php Code
  1. <?php
  2. .
  3. .
  4. .
  5.  
  6.  
  7. $query1="select question,
  8.                 option1,
  9.                 option2,
  10.                 option3 from questions
  11.          where qno='$numbers' ";
  12. $result1=mysql_query($query1,$db_connectio) or die(mysql_error());
  13. }while(@mysql_num_rows($result1)==0);
  14.  
  15. $i=$_SESSION['count'];
  16. while ($row = @mysql_fetch_object ($result1))
  17. {
  18.  
  19. print "<html><head><style>
  20. <!--
  21. body {}
  22. p.thirty {width: 60%; height: 50%;  border: 1px solid black}
  23. -->
  24. </style>
  25. </head><body><p class="thirty"><br>&nbsp;&nbsp;<table><tr><td><i>Question </i>" . $i . ":<font style="verdana" color="#000000"><b> " . $row->question
  26. . "</b></font><form action='result.php' method='post'>
  27. <input type='hidden' name='i' value='" . $i . "'>
  28. <input type='hidden' name='question' value='" . $row->question . "'></td>
  29. <input type='hidden' name='number' value='" . $number . "'>
  30. <td align='right'><font style="sans-serif" color="#999999">
  31. <input type='radio'  name='corr' value='option1'>$row->option1<p></font><font style="sans-serif" color="#999999">" .
  32. "<input type='radio'  name='corr' value='option2'>$row->option2<p></font><font style="sans-serif" color="#999999">" .
  33. "<input type='radio'  name='corr' value='option3'>$row->option3<p></font></td></tr><tr>
  34. <td align='right'><input type='submit' name='submit' value='OK'></td></tr></form><br></p></body></html>";
  35. //++$i;
  36. }
  37. print'</div>';
  38. ?>

Reply With Quote
  #2  
Old June 25th, 2005, 10:53 AM
lmz lmz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 79 lmz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: a TEASER 4 U ALL

<form action="result.php" method="post" onsubmit="cheka()" name="form1">
<script language="JavaScript">
function cheka(){
if(!form1.corr.checked){alert('Answer plz');return false;}
}
</script>

try it!

Reply With Quote
  #3  
Old June 25th, 2005, 11:27 AM
navajes123 navajes123 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: goa,india
Posts: 68 navajes123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to navajes123
RE: a TEASER 4 U ALL

well it works but not the way i want...i changed onsubmit to onmouseover..
php Code:
Original - php Code
  1.  
  2.     <form action="result.php" method="post" onsubmit="cheka()" name="form1">
  3. <script language="JavaScript">
  4. function cheka(){
  5. if(!form1.corr.checked){alert('Answer plz');return false;}
  6. }
  7. </script>


now the problem is that even when i select one of the answers and move the mose over the button i get the alert which shouldnt happen
the alert shld pop only when i dont select any answer

Reply With Quote
  #4  
Old June 27th, 2005, 08:32 AM
lmz lmz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 79 lmz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: a TEASER 4 U ALL

<input type='submit' name='submit' value='OK' onmouseover="cheka1()">

<script language="JavaScript">
function cheka1(){
if(!form1.corr.checked){alert('Answer plz');return false;}
}
</script>

i think in that way u can do it.

Reply With Quote
  #5  
Old June 27th, 2005, 09:14 AM
navajes123 navajes123 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: goa,india
Posts: 68 navajes123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to navajes123
RE: a TEASER 4 U ALL

ooopsss!! that does not work....soorrry.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > a TEASER 4 U ALL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT