Jump to content
  • 0

JavaScript homework need help


Question

Posted

basically since i cant put french words in english on how to do the work i have to make a javascript code that tells you what is the maximum value in between the numbers 7 and 8, and the minimu value between 2 and 4 using the if, else if , and basically i have to compare but im having issues with my coding anyone want to help me? this is for a college class..

12 answers to this question

Recommended Posts

  • 0
Posted
Just to be sure, this is "Javascript" and not "Java," right? Because I could help with the latter.

Where were you when I was developing some software for the place I work that never actually got any use and was scrapped as soon as I finished writing it?

I needed help! Thank God for google.

  • 0
Posted (edited)

I can help you on that either in french or english you choose.

I don't see why you want to do that but post your actual code and i'll see what I can do.

basically since i cant put french words in english on how to do the work i have to make a javascript code that tells you what is the maximum value in between the numbers 7 and 8, and the minimu value between 2 and 4 using the if, else if , and basically i have to compare but im having issues with my coding anyone want to help me? this is for a college class..
Edited by Levesque 1st MRB
  • 0
Posted

alright so this is what i have to do

<script language="javascript">
<!--
function creerTable1()
{
document.write("<table border=1>");
document.write("<tr>");
document.write("<td>");
document.write(" "); //   désigne une espace insécable (non breaking space)
document.write("</td>");
document.write("</tr>");
document.write("</table>")
}
// -->
</script>

Inspirez-vous de la fonction CreerTable1() ci-dessus pour créer une fonction CreerTable2 qui permette de créer une table HTML aux dimensions spécifiées par les paramètres. Le premier paramètre spécifie le nombre de rangées et le deuxième, le nombre de colonnes. Indice: vous devez utiliser des itérations (boucles) ....

and then this is what i have for now i want to know if im on the right track

<Html>
<Head>
<Title> Exercices 2</Title>
<script language="javascript">
<!--
function creerTable1(nbligne,nbcolonne)
{
document.write("<table border=1>");
document.write("<br>");
for (i=0;i<nbligne;i++){
document.write("<tr>");
for (j=0;j<nbcolonne;j++){
document.write("<td>");
document.write(" ");
document.write("</td>");
}
document.write("</tr>");
}
document.write("</table>")
}
// -->
</script>
</head>
<Body onload="creerTable1(5,3)">
<Table BorderCellPadding=10>
</Body>
</Html>

  • 0
Posted

Alright yet another problem i cant remember how to make a usefull alert() window, to show the information gathered from the name and everything this is the question.

so yeah if i didnt explain clearly enough i will be on vent at around 4 pm eastern, to get help thanks for all the help i got already guys.

Pour cette tâche vous devrez utiliser votre connaissance des tableaux et des boîtes de dialogue.

Dans une premier temps vous devrez définir un tableau de 3 éléments. Chacun des éléments sera associé à un prénom différent.

Ensuite vous devrez réaliser une première fonctions qui permettera d'ajouter un prénom dans le tableau. La fonction prendra en paramètre le tableau préalablement créé et retournera un tableau contenant un élément supplémentaire dont la valeur sera le prénom que l'on souhaite ajouter. Vous devrez utiliser la boîte de dialogue de type prompt pour demander à l'usager de spécifier le prénom qu'il souhaite ajouter au tableau.

Vous devrez également réaliser une seconde fonction qui aura pour but d'afficher les prénom qui sont compris dans les différents éléments du tableau. Cette fonction prendra également le tableau en paramètre et procèdera à l'affichage des noms à l'aide d'une boîte de dialogue de type alert qui contient l'ensemble des prénom séparé par des ";".

<html>
<head>
<title>Ex. 4</title>
<Table border="1" cellpading="5">
<FORM name="mon_formulaire">
<tr><td><INPUT type=text  value="" name="mon_champ_texte" onBlur="this.style.backgroundColor='yellow'"  readonly ><INPUT type=button value="Prenom" onClick="PromptMessage()"></tr></td>
</FORM>
<script language=javascript>
   function PromptMessage() {
       var saisie = prompt("Saisissez votre texte :", "Texte par défaut")
       if (saisie!=null) {
           document.forms["mon_formulaire"].elements["mon_champ_texte"].value=saisie;
       }
   }
</SCRIPT>
<FORM name="mon_formulaire1">
<tr><td><INPUT type=text  value="" name="mon_champ_texte1" onBlur="this.style.backgroundColor='yellow'"  readonly ><INPUT type=button value="Nom" onClick="PromptMessage1()"></tr></td>
</FORM>
<script language=javascript>
   function PromptMessage1() {
       var saisie1 = prompt("Saisissez votre texte :", "Texte par défaut")
       if (saisie1!=null) {
           document.forms["mon_formulaire1"].elements["mon_champ_texte1"].value=saisie1;
       }
   }
</SCRIPT>
<FORM name="mon_formulaire2">
<tr><td><INPUT type=text  value="" name="mon_champ_texte2" onBlur="this.style.backgroundColor='yellow'"  readonly ><INPUT type=button value="Age" onClick="PromptMessage2()"></tr></td>
</FORM>
<script language=javascript>
   function PromptMessage2() {
       var saisie2 = prompt("Saisissez votre texte :", "Texte par défaut")
       if (saisie2!=null) {
           document.forms["mon_formulaire2"].elements["mon_champ_texte2"].value=saisie2;
       }
   }
   </SCRIPT>
   <FORM name="mon_formulaire3">
   <tr><td><INPUT type=button value="Afficher donnée" name="">
    <script language=javascript>
    function  promptmessage3() {
    var a = "mon_formulaire";
    var b = "mon_formulaire1";
    var c = "mon_formulaire2";
    var d = a+b+c
       var vos_donnée = alert(d);
       if (vos_donnée!=null) {
            
       }
    }  
</SCRIPT>
<body bgcolor="Blue">
</body>
</html>

  • 0
Posted

I believe when your teacher told you about "tableau" he meant arrays instead of tables.

So here is a startup you can use :

<html>

<head>

</head>

<title>Ex. 4</title>

<body bgcolor="Blue">

<script language=javascript>

var monTableauDePrenom = new Array(3);

monTableau [0] = "Prenom1";

monTableau [1] = "Prenom2";

monTableau [2] = "Prenom3";

var monTableauPlusGrand = new Array(4);

monTableauPlusGrand = ajouterPrenom(monTableauDePrenom);

//TODO afficher le tableau

function ajouterPrenom(monTableauDePrenom) {

var monTableau = new Array(4);

monTableau [0] = monTableauDePrenom [0]

monTableau [1] = monTableauDePrenom [1]

monTableau [2] = monTableauDePrenom [2]

monTableau [3] = "Prenom4";

return monTableau;

}

</SCRIPT>

</body>

</html>

  • 0
Posted

honestly i gave up on this exercise i did all my other 3 that were left Lévesque can u do it for me plz :) as a friend? a fellow canadian :P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Recent Posts

    • Cannon: I used probability to shoot you in that bush Candy. Candy: What is that "Bush Probability Focus?" Ucar: "Bush probability Focus?" Thats what I call sex. Everyone laughs.  
    • Welcome to the 1st Marine Raider Battalion! Now that you have been accepted don't forget to: 1. Check in at the Recruit Depot 2. Read the Marine Raider Handbook (you are expected to know everything in it) 3. Change your steam friends Avatar 4. Download, install and log into Discord NOTE: Please be aware that you will not have access to the above links until an officer has given you full access to the forum. Access to the forum should be given to you within the next day.
    • MARINE CORPS ENLISTMENT OFFICE Camp Pendleton, CA   RECRUITMENT LETTER     Hello F. Flobbs   Thank you for taking interest in joining the 1st Marine Raider Battalion. There are a few things you should know before I give you a date for Basic Combat Training (BCT). Firstly, you are restricted to the weapon class of Rifleman for the duration of your time as a Recruit. Secondly, any questions you have about our unit, alternate times for your BCT, or just rules in general, you should contact your drill instructors GySgt. R. Fielding, 1stSgt. J. Candy, CWO. A. Pitteway, and 2ndLt. R. Martinez.    BCT will be Held on a day communicated to you by a member of the Drill Instructor team.   Do not hesitate to reach out to our Drill Instructors for additional information. They can be reached through the Forum Private Messaging System most reliably (click the envelope next to their name above).   Upon stating that you understand all the information here, an admin will change your forum name and login to be:   Flobbs 1st MRB   Take the time now to change your Steam and in-game name to:   Rec. F. Flobbs [1st MRB]   Please make sure to verify your forum account by checking your email. Also, please respond below with a reply showing that you have read and understand these rules and restrictions set. You cannot be fully accepted until you do so. We have a limit on the time to reply, if you do not do so within 48 hours, your application will be denied. Once you reply, you will be approved for your BCT unless otherwise posted.  
    • 1. Name you wish to use and Age:, (Our unit uses realistic names, this does not have to be your real name) Flobbs 2. Platform Type, Steam 3. Steam ID (Use 17 Digit SteamID 64 / PC Game Pass Account Username):, 76561198031905030 4. Do you have a microphone?, Yes 5. Which game title are you applying for?, Day of Defeat: Source 6. If you've selected Hell Let Loose, do you understand that this game is currently not cross platform capable and only PC players currently may apply? ( Steam or PC Game Pass), Yes 7. Why do you wish to join the 1st Marine Raiders?, Fielding is making me. no, known everyone for a while 8. Did any of our current members play a part in you enlisting? If so, who? If none, how did you learn about us:, lots, but I suppose Fielding 9. This unit offers more than just a place to play games with each other, do you have any online skills you think would be useful?, several. Ran a large 300 person DOD group back in my days. Ran a few for other games, Ran one for HLL. Developed software, plugins, websites, .... just ask 10. Do you have any Leadership experience that you think will be helpful?, yes 11. Have you ever been in a realism unit before, and if so, which unit was it?, no 12. By posting this Enlistment form, I acknowledge the instructions completely, declare that I am 16 years old or older, and agree that I have and will follow server and unit rules maturely and respectfully or face immediate rejection., Yes Submission stats UserId: 112220260907614208 Username: flobbs User: @Flobbs™ Duration: 363s Joined guild 3 years ago
×
×
  • Create New...