473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Failed to get correct o/p due to wrong in if condition

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5.     <script type="text/javascript" charset="utf-8" </script>
  6.     <script type="text/javascript" src="search.js" ></script>
  7.     <script type="text/javascript" charset="utf-8">
  8.  
  9.     function search()
  10.         {
  11.          var x=document.getElementById("From").selectedIndex;
  12.          var y=document.getElementById("From").options;
  13.          var z=y[x].text;
  14.           if(z==Mango)
  15.           {
  16.           document.write('hi');
  17.           }        
  18.         if(z==Apple)
  19.           {
  20.            document.write('hello');
  21.           }
  22.         if(z==Orange)
  23.           {
  24.           document.write(z);
  25.           }
  26.        document.write('haaai');
  27.           }                
  28.     </script>
  29. </head>
  30.     <body bgcolor="#ffccff" >
  31.     <header>
  32.     <table>
  33.         <tr>
  34.             <td><p style="margin-left: 15px;font-size: 
  35.  
  36. 25px;font-style: inherit;font-family:serif; ">Plan The Journey 
  37.  
  38. </p></td>
  39.  
  40.  
  41.     </table>
  42.       </header>
  43.       <fieldset style="margin-top: 50px">
  44.       <form name="Fruits">
  45.  
  46.           From:<br>
  47.           <select id="From">
  48.         <option value="Apple">Apple</option>
  49.         <option value="Mango">Mango</option>
  50.         <option value="Orange">Orange</option></select><br>
  51.  
  52.  
  53.           <br><input type="submit" name="SEARCH" value="SEARCH" 
  54.  
  55. onclick="search()" style="margin-left: 50px"/>
  56.            </form>
  57.       </fieldset>
  58.  
  59.       </body>
  60.       </html>
Jun 11 '12 #1
1 1363
Dormilich
8,658 Expert Mod 8TB
document.write(), if used after the page loaded, will cause JS to erase the current document, including all scripts.
Jun 11 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
1
by: Big Dix | last post by:
I am dealing with three different database files. If the user (me) chooses to edit File 1 it opens File1.csv and so onfor File 3 But File three needs to written in a different format then File 1...
0
by: Tony Scarpelli | last post by:
I've been getting a "Server execution failed" error when I click on help lately in visual studio .net 2003. I haven't had the problem before, but I've been installing some of the Pocket PC sdk's...
5
by: Adfra | last post by:
Hi, Situation is: Used an embedded query which was "optimized" be Access with Brackets ("()" -> "."). Now problem is: I get the error "Syntaxerror in From part" in normal view as well as in...
17
by: so many sites so little time | last post by:
all right so the script is pretty simple it goes it retrives what the id of the post is and it lets you edit it well no it doesnt. now if you go to www.kirewire.com/pp2/index/php you will see a...
9
by: Randy | last post by:
Hi all, I've been working on a simple two column layout for a site, but according to browsershots.org, my desing is not showing up correctly in Win/IE 5.01, 5.5 & 6 ! Please see details here:...
11
by: rakeshvthu | last post by:
hi all, i am new bee to script and some how i find code to clear data of clipboard it is working fine for IE browser not for Firefox can any one help me out what all we need to change in...
9
by: Tiruak | last post by:
Ok, from the title you can probably tell im a beginner to Flash. I'm using CS3, and am trying to create a "menu" to this one webpage. I did 4 animated buttons, but now im having problems making...
2
by: AliRezaGoogle | last post by:
Hi group There are many RELATIONAL databases like MS SQL server. They are not called object oriented database because their base concept is row and not object. But suppose following scenario: I...
1
by: Celanese | last post by:
Is there anyway to open a form and have the WHERE condition change based on which subform the user was on? I currently do this with 3 different codes, and 3 different buttons, but i'd like to just...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.