AJAX | JavaScript | HTML | PHP Answers

Questions: 323

Answers by our Experts: 213

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Code and interface on how to validate text boxes, combo boxes radio button.
Write a script that inputs a telephone number as a string in the form (555)555-5555. The script should use String method split to extract the area code as a token, the first three digits of the phone number as a token and the last four digits of the phone number as a token. Display the area code in one text field and the seven-digit phone number in another text field.
How do I create a hyperlink with text that will open (or display) a list <ul> below, using <onClick> tags, when selected; then when selected again will close the list?
QUESTION 1
Answer in javascript ..You are given a table that shows the total number of cars sold by a local car manufacturer in Johor Bharu for the first six months in the year 2008.

Month Jan Feb Mar Apr May Jun
Number of cars sold (units) 191 196 269 308 236 145
Based on the figures given above, you required to write a Java program using array which can perform the following:

• Average number of cars sold
• The month that achieve lowest sales
What is difference between ID and CLASS selector in css?
First name:
Last name:

wamp server dose not show any error but it cant store data in database plz any one help me.
First name:
Last name:

wamp server dose not show any error but it cant store data in database plz any one help me.
Hi all could someone help me out with this please.

You will have seen that the outline code also contains a partially written function ubbiDubbi() which is to take a string argument and translate it into Ubbi Dubbi according to the rule we are using.
Currently this function declares and initialises some variables but contains no code that will actually translate the argument. The structured English below describes the algorithm necessary to perform the translation. For convenience we have numbered the steps.
1.
initialise precedingCharacter to an empty string
2.
for each position in the string
3.
assign the character at that position to currentCharacter
4.
if (isVowel(currentCharacter) AND (NOT isVowel(precedingCharacter))
5.
concatenate 'ub' to the result string
6.
end if
7.
concatenate currentCharacter to the result string
8.
assign the current character to precedingCharacter
9.
end for
10.
return the result string


Does anyone know what code goes in the script below from the stuctured english above thanks





// Program to translate a message into "Ubbi Dubbi"


// PROVIDED FUNCTION -- you do not need to change it

/*
* determines if the argument is a vowel
*
* function takes one argument representing a character to be tested and returns
* -- true if the argument is a single uppercase or lowercase character which is a vowel
* -- false otherwise .
*/
function isVowel(aCharacter)
{
return ((aCharacter == 'a') || (aCharacter == 'A')||
(aCharacter == 'e') || (aCharacter == 'E')||
(aCharacter == 'i') || (aCharacter == 'I')||
(aCharacter == 'o') || (aCharacter == 'O')||
(aCharacter == 'u') || (aCharacter == 'U')||
(aCharacter == 'y') || (aCharacter == 'Y'));
}


// INCOMPLETE FUNCTION -- supply missing code where indicated for part (ii)(a)

/*
* translates a word into Ubbi Dubbi
*
* function takes a string argument and returns a second string
* which is the first one translated into Ubbi Dubbi.
*/
function ubbiDubbi(aString)
{
// variable to hold resultString
var resultString = '';

// variable to hold the current and previous characters
var currentCharacter;
var precedingCharacter;

// in the case of the first character in the string there is no
// previous character, so we assign an empty string '' to the variable at first
precedingCharacter = '';

// TODO part (ii)
// add code as directed in the question
}

// TEST 1
var string1 = 'the cat sat on the mat';
var result1 = ubbiDubbi(string1); // result should be 'thube cubat subat ubon thube mubat'
document.write(string1)
document.write('<BR>');
document.write(result1)
document.write('<BR>');
if (result1 == 'thube cubat subat ubon thube mubat')
{
document.write('test passed');
}
document.write('<BR>');
Hi I have been asked to answer the below and i just cant get my head around it as ive only just started javascript/arrays

If anyone could help me id be greatly thankful
I need to product the table output as per below
web page header: election results

header or table: Fantanswill Historical society by-election results

Mr R Green...33
Ms O brown...51
Ms Y Black....43
Mr G White...22
Ms B Grey....61
Ms I Blue.....51
Mr V Pink....47
Ms B Grey .... Is hereby declared elected

The below is he script i need to amend to make the above table of output.
Can anyone please help me as im now puling my hair out and cant get it to work
thanks in advance xx

<title>
Election Results
</title>
<link rel="stylesheet" type="text/css" href="tma03.css">
<script language="JavaScript">
& /*
& *& M150 TMA03 2011B Q3.
& *& Program to report the results of an election.
& */

// SAMPLE DATA
// candidates
var candidateArray =
['Mr R Green...', 'Ms O Brown...', 'Ms Y Black...', 'Mr G White...', 'Ms B Grey....','Ms I Blue....', 'Mr V Pink....'];
// online votes
var onlineVotesArray = [21,47,23,11,56,47,30];
// paper votes
var paperVotesArray = [12,4,20,11,5,4,17];

// SECOND& DATA& SET
// TODO part (v) comment out the SAMPLE DATA above and uncomment the second set below by removing the /* and */
/*
var candidateArray =
['Ms A& Brown .......', 'Mr C Smith .......', 'Ms F Patel .......', 'Ms B Jones .......', 'Mr E Williams...', 'Mr D Johnson ....', 'Ms G Taylor'];
// online votes
var onlineVotesArray = [41,37,43,11,59,21,36];
// paper votes
var paperVotesArray = [22,3,15,11,7,1,18];
*/

// TODO part (i)
// total votes --& to be initialised below
var totalVotesArray;
// Add code to
//& & & -- initialise totalVotesArray with a new empty array of the same size as candidateArray
//& & & --& use a loop to add the online and paper votes for each candidate and store the result at
//& & & & & & & the corresponding position in the total votes array.

// TODO part (ii)
// Add code to display two lines of heading, then a blank line,
// then a list of candidates with the total votes cast for each.
&
// Variable to store the index at which the maximum total vote occurs.
var maximumTotalVoteIndex;
// TODO part (iii)(b)
// Add code to determine the index at which the maximum total vote occurs.
&
//TODO part (iv)
//Add code to report which candidate has been elected.
</script>
Can someone advice me with this javascript please...?
Hi all could someone help me out with this please.

You will have seen that the outline code also contains a partially written function ubbiDubbi() which is to take a string argument and translate it into Ubbi Dubbi according to the rule we are using.
Currently this function declares and initialises some variables but contains no code that will actually translate the argument. The structured English below describes the algorithm necessary to perform the translation. For convenience we have numbered the steps.
1.
initialise precedingCharacter to an empty string
2.
for each position in the string
3.
assign the character at that position to currentCharacter
4.
if (isVowel(currentCharacter) AND (NOT isVowel(precedingCharacter))
5.
concatenate 'ub' to the result string
6.
end if
7.
concatenate currentCharacter to the result string
8.
assign the current character to precedingCharacter
9.
end for
10.
return the result string


Does anyone know what code goes in the script below from the stuctured english above thanks





// Program to translate a message into "Ubbi Dubbi"


// PROVIDED FUNCTION -- you do not need to change it

/*
* determines if the argument is a vowel
*
* function takes one argument representing a character to be tested and returns
* -- true if the argument is a single uppercase or lowercase character which is a vowel
* -- false otherwise .
*/
function isVowel(aCharacter)
{
return ((aCharacter == 'a') || (aCharacter == 'A')||
(aCharacter == 'e') || (aCharacter == 'E')||
(aCharacter == 'i') || (aCharacter == 'I')||
(aCharacter == 'o') || (aCharacter == 'O')||
(aCharacter == 'u') || (aCharacter == 'U')||
(aCharacter == 'y') || (aCharacter == 'Y'));
}


// INCOMPLETE FUNCTION -- supply missing code where indicated for part (ii)(a)

/*
* translates a word into Ubbi Dubbi
*
* function takes a string argument and returns a second string
* which is the first one translated into Ubbi Dubbi.
*/
function ubbiDubbi(aString)
{
// variable to hold resultString
var resultString = '';

// variable to hold the current and previous characters
var currentCharacter;
var precedingCharacter;

// in the case of the first character in the string there is no
// previous character, so we assign an empty string '' to the variable at first
precedingCharacter = '';

// TODO part (ii)
// add code as directed in the question
}

// TEST 1
var string1 = 'the cat sat on the mat';
var result1 = ubbiDubbi(string1); // result should be 'thube cubat subat ubon thube mubat'
document.write(string1)
document.write('<BR>');
document.write(result1)
document.write('<BR>');
if (result1 == 'thube cubat subat ubon thube mubat')
{
document.write('test passed');
}
document.write('<BR>');
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS