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

    • Name: Germ-E-Nader [Germinator]   Steam I.D: STEAM_0:0:520043914   Duration of Ban: Permanent   Reasons for the Ban: Racism   Demo Provided?: N   Comments: Started into a political, racist rant in chat. He was warned by Keebler, DapperxDuck, and myself of the consequences of continuing. He didn't listen.
    • This is under deliberation by our MP staff.  We will notify you of a decision when one is made.
    • 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 B. Calypso, Thank you for taking interest in joining the 1st Marine Raider Battalion.   During your trial period the following will occur: Once accepted as a Recruit, you will remain as a Recruit for 2 weeks from the day of your acceptance until the next BCT Class is offered. During your time as a recruit, it is highly encouraged to play within the Public Server and join Discord with our other members. Upon acceptance, you will be contacted by one of our DIs when the next available BCT is scheduled via the appropriate Discord channel.   We have a BCT class every two weeks. Please keep an eye out for when the next one is made available once you've completed your time requirements!   Upon stating that you understand all the information here, an admin will change your forum name and login to be :   Calypso 1st MRB   Take the time now to change your Steam and in-game name to:   Rec. B. Calypso [1st MRB] (Example: Rec. J. Doe [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. 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 trial period unless otherwise posted.  
×
×
  • Create New...