GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-May-2009, 01:15
mibit mibit is offline
New Member
 
Join Date: May 2008
Posts: 3
mibit is on a distinguished road

Write a JavaScript/HTML program that inputs two integers a and b


Write a JavaScript/HTML program that inputs two integers a and b in an input text box, and outputs all odd numbers between
a and b (a and b are expected to be between 1 and 30, and a<b)

can somebody help me with the source code for the .html file

Thanks a million
  #2  
Old 05-May-2009, 10:21
MisterChucker's Avatar
MisterChucker MisterChucker is offline
Junior Member
 
Join Date: Mar 2009
Location: Cyberspace, Earth
Posts: 53
MisterChucker is a jewel in the roughMisterChucker is a jewel in the roughMisterChucker is a jewel in the rough

Re: Write a JavaScript/HTML program that inputs two integers a and b


Have you tried anything? Post some code.

This looks like a homework assignment. You need to prove that you have put some effort into finding the answer.
  #3  
Old 22-May-2009, 11:35
rollyjam rollyjam is offline
New Member
 
Join Date: May 2009
Posts: 1
rollyjam is an unknown quantity at this point

Re: Write a JavaScript/HTML program that inputs two integers a and b


here try to check this one



javascript Syntax (Toggle Plain Text)

1.
<?xml version="1.0" encoding="utf-8"?>
2.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3.
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5.
<head>
6.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
7.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8.
<meta http-equiv="Content-Style-Type" content="text/css" />
9.
<meta http-equiv="Content-Script-Type" content="text/javascript" />
10.
<title>JavaScript DEMO : Odd Numbers</title>
11.
<style type="text/css">
12.
/* <![CDATA[ */
13.
table {
14.
border : 1px solid #D0D0D0;
15.
border-collapse : collapse;
16.
text-align : left;
17.
width : 70%;
18.
}
19.
td, th {
20.
border-bottom : 1px solid #D0D0D0;
21.
padding : .300em;
22.
}
23.
input[type='text'] {
24.
border-bottom : 2px solid #D0D0D0;
25.
color : #696969;
26.
font-weight : bold;
27.
height : 17px;
28.
text-align : center;
29.
}
30.
/* ]]> */
31.
</style>
32.
<script type="text/javascript">
33.
// <![CDATA[
34.
var result, odds, viaID;
35.
viaID = Boolean( document.getElementBy );
36.
odds = [];
37.
result = function() {
38.
uA = parseInt((( viaID ) ? document.getElementById("unitA").value : document.all.unitA.value ));
39.

40.
uB = parseInt((( viaID ) ? document.getElementById("unitB").value : document.all.unitB.value ));
41.

42.
oLen = Math.max( uA, uB );
43.
min = Math.min( uA, uB );
44.
output = (( viaID ) ? document.getElementById("odd") : document.all.odd );
45.

46.
output.innerHTML = "<p>The odd number's between " + (Math.min( uA, uB)) + " and " + (Math.max( uA, uB)) + " are:</p><hr />";
47.
for ( var x = min; x <= oLen; x++ ) {
48.
odds[x] = x / 2 ;
49.
OdN = parseFloat( odds[x].toString().split(/(^\d+$)/)[0] );
50.
output.innerHTML += (( odds[(OdN * 2)] === undefined ) ? "" : "<b>" + ( OdN * 2 ) + "</b>, " )
51.
} output.innerHTML += "<hr />";
52.
};
53.
// ]]>
54.
</script>
55.
</head>
56.
<body>
57.
<div id="main">
58.
<table frame="box" rules="none" summary="Getting Odd number&apos;s between two integer">
59.
<caption><span>JavaScript DEMO:</span> Getting the Odd Number's Between A &amp; B</caption>
60.
<colgroup align="center">
61.
<col />
62.
<col />
63.
<col />
64.
</colgroup>
65.
<thead>
66.
<tr>
67.
<th><label for="unitA">Unit A</label></th>
68.
<th><label for="unitB">Unit B</label></th>
69.
<th><button id="btn" name="btn" onclick="result();">Show The Odd's!</button></th>
70.
</tr>
71.
</thead>
72.
<tfoot>
73.
<tr>
74.
<th>Result&apos;s</th>
75.
<td colspan="2"><div id="odd" style="text-align: left;"></div></td>
76.
</tr>
77.
</tfoot>
78.
<tbody>
79.
<tr>
80.
<td><input type="text" id="unitA" name="unitA" value="" size="10" /></td>
81.
<td><input type="hidden" id="base" name="base" value="" /><input type="text" id="unitB" name="unitB" value="" size="10" /></td>
82.
<td style="background-color : #ccc;"> </td>
83.
</tr>
84.
</tbody>
85.
</table>
86.
</div>
87.
</body>
88.
</html>
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Equation solver RazoR C Programming Language 3 18-May-2008 09:24
Write a C++ program to implement a cash register program Computeretard66 C++ Forum 2 29-Feb-2008 08:05
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 10:13
Anyone can write a program code for this??? chriskan76 C Programming Language 1 19-Oct-2004 20:25

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:39.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.