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.
×
×
  • Create New...