Téléchargement
illégal
Posez votre question Signaler

HTML : 1 background dans 1 tableau [Résolu]

tomtom - Dernière réponse le 5 janv. 2012 à 16:18
Bonjour tlm,
Je souhaiterai savoir s'il est possible d'avoir un redimensionnement automatique pour une image en fond dans un tableau ( je sais que c'est possible en non-fond avec la balise <Img> mais est-ce possible avec <table><tr><td background=...png" ....), s'il existe un attribut genre bgalign ou autre.
Si c'est infaisable faite moi signe ^^
Merci!

tomtom
Lire la suite 

HTML : 1 background dans 1 tableau »

13 réponses
Réponse
+8
moins plus
Bonjour,

Biensur c'est possible, utilise le css:
<TD STYLE="background-image: url(image.jpg)">l</TD>

Lode
Ajouter un commentaire
Réponse
+2
moins plus
Pour avoir deux backgrounds
il faut deux div.
Tu les crées en CSS :
#derriere{
background-image: url(tonimage);
}

#devant{
background-image: url(tonimage);
background-repeat: no-repeat;
background-align: center;
}


Et tu les insère en HTML:
<div id="derriere">
<div id="devant">
Ton texte
</div>
</div>


Ululo
Ajouter un commentaire
Réponse
+1
moins plus
<html>
<head><titel><java</titel><script language="javascript">
function bleu(){
document.bgColor="blue";
}
Function rouge(){
document.bgColor="red";
}
function vert(){
document.bgColor="green";
}
</script>
</head>
<body>
<script language="javascript">
document.alert("bonjour");
</script>
<form>
<input type="button" value="bleu" onClick="bleu();">
<input type="button" value="rouge" onClick="rouge();">
<input type="button" value="vert" onClick="vert();">
</from>
</body>
</html>


***********************************************************
je c pas pk sa marche pas. merçi de maidé
Ajouter un commentaire
Réponse
+0
moins plus
je n'ai pas encore utilisé le CSS pr mes pages html mais je compte bien le faire; merci bcp pr ton aide
tomtom
Ajouter un commentaire
Réponse
+0
moins plus
j'ai pas trouver ce qu'il faut mettre dans ma feuille de style pour définir que mon image de fond doit se mettre aux dimensions de ma cellule
j'ai essayé avec des truc dans le genre

.background-image { width:100% height:100% }

mais l'image ne se redimensionne pas. pourrais-tu m'indiquer les propriétés concerné stp voir carrément la formule a taper dans le .css
Ajouter un commentaire
Réponse
+0
moins plus
background-image n'est pas supporté sous Outlook 2007, gmail et live mail... :(

http://www.campaignmonitor.com/...
Ajouter un commentaire
Réponse
+0
moins plus
bonjour,
quelle qu'un pourrai me dire si se serai possible d avoir 2 background :
un fixe en arrière, et un mobile avec le texte au centre
merci,
Ajouter un commentaire
Réponse
+0
moins plus
Bien le bonjour,

essaie comme ça :

<html> 
<head>
<script language="javascript"> 
function bleu(){ 
document.bgColor="blue"; 
} 
function rouge(){ 
document.bgColor="red"; 
} 
function vert(){ 
document.bgColor="green"; 
} 
</script>
</head> 
<body> 

<form> 
<input type="button" value="bleu" onClick="javascript:bleu();"> 
<input type="button" value="rouge" onClick="javascript:rouge();"> 
<input type="button" value="vert" onClick="javascript:vert();"> 
</form> 
</body> 
</html>


J'ai enlevé la fonction bonjour car je ne sais pas si elle te sert vraiment.
Fais attention aux majuscules et à la syntaxe correcte des balises, car c'étaient les 2 principales causes qui faisaient que ton code ne fonctionnait pas.

@ pluche.
Faboons.
Ajouter un commentaire
Réponse
+0
moins plus
salut a tt le monde............
Voila j'ess re fair une calculatrice simple ds ma page html mais jarrive pas a fair les fonction
voici mon pgm :

<html>
<head><title>js1</title>
<script language="javascript">
function r1(){

}
</script>
</head><center>

<form>


<input type="text" name="" value=" " onClick=""> <br>

<input type="button" name="hh" value="7 " onClick="r1()">
<input type="button" name="hh" value="8 " onClick="r1()">
<input type="button" name="hh" value="9 " onClick="r1()">
<input type="button" name="hh" value="+ " onClick="r1()"> <br>

<input type="button" name="hh" value="6 " onClick="r1()">
<input type="button" name="hh" value="5 " onClick="r1()">
<input type="button" name="hh" value="4 " onClick="r1()">
<input type="button" name="hh" value="- " onClick="r1()"> <br>

<input type="button" name="hh" value="3 " onClick="r1()">
<input type="button" name="hh" value="2 " onClick="r1()">
<input type="button" name="hh" value="1 " onClick="r1()">
<input type="button" name="hh" value="/ " onClick="r1()"> <br>

<input type="button" name="hh" value="div " onClick="r1()">
<input type="button" name="hh" value="0 " onClick="r1()">
<input type="button" name="hh" value="sqrt" onClick="r1()">
<input type="button" name="hh" value="* " onClick="r1()"> <br>

<input type="button" name="hh" value="= " onClick="r1()">

</from></center> </html>

la touche DIV est le reste de la division et la touche SQRT est est la racine carré

Merçi de bien m'aider et encor merçi
nakumi - 5 janv. 2012 à 16:18
<html>
<head>
<title> Ma calculatrice </title>
<script language="javascript">
function screen(ecran){
document.nakumi.affich.value=
document.nakumi.affich.value+ecran;
}

function cal(result) {
var solut = eval(result);
document.nakumi.affich.value=solut;
}
</script>
<body bgcolor="#FFFFCC">
<center>
<font color="blue" size=7><b><u>
CALCULATRICE
</center></b></u>
<center>
<hr><br>
<br>
<table border=2>
<tr><td>
<FORM name="nakumi" >

<br>
<input type="text" name="affich" size="47" style="height:50px"><br><br><br>
 <input type="button" style='width: 70px; height: 50px' value="7" onClick="screen(7)">
 <input type="button" style='width: 70px; height: 50px' value="8" onClick="screen(8)">
 <input type="button" style='width: 70px; height: 50px' value="9" onClick="screen(9)">
 <input type="button" style='width: 70px; height: 50px' value="/" onClick="screen('/')"><br><br>
 <input type="button" style='width: 70px; height: 50px' value="4" onClick="screen(4)">
 <input type="button" style='width: 70px; height: 50px' value="5" onClick="screen(5)">
 <input type="button" style='width: 70px; height: 50px' value="6" onClick="screen(6)">
 <input type="button" style='width: 70px; height: 50px' value="*" onClick="screen('*')"><br><br>
 <input type="button" style='width: 70px; height: 50px' value="1" onClick="screen(1)">
 <input type="button" style='width: 70px; height: 50px' value="2" onClick="screen(2)">
 <input type="button" style='width: 70px; height: 50px' value="3" onClick="screen(3)">
 <input type="button" style='width: 70px; height: 50px' value="-" onClick="screen('-')"><br><br>
 <input type="button" style='width: 70px; height: 50px' value="0" onClick="screen(0)">
 <input type="button" style='width: 70px; height: 50px' value="=" onClick="cal(affich.value)">
 <input type ="reset" style='width: 70px; height: 50px' value="c">

 <input type="button" style='width: 70px; height: 50px' value="+" onClick="screen('+')"><br>

</td></tr>
</table>
</center>
</form>
</body>
</html>
Ajouter un commentaire
Réponse
+0
moins plus
Hola,

donc ton précédent problème est résolu ?
Ajouter un commentaire
Réponse
+0
moins plus
oui merçi bcp c bon.........mnt il me reste le probleme de la calculatrice
encre merçi
Ajouter un commentaire
Réponse
+0
moins plus
Hola,

Ton html :

<html>
<head>
<title>Propix - Calculator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta name="keywords" content="Propix, free javascript calculator, freeware calculator, download calculator, JavaScript calculator, component, applet, source, javascripts">
<meta name="description" content="Fully configurable JavaScript calculator. Free software.">
<meta name="author" content="Pintér Gábor, propix@freemail.hu; http://www.propix.hu">
<link rel="stylesheet" href="/styles/main.css" type="text/css">
<script src="/register/log.js"></script>
<script src="/util/util210.js"></script>
<script src="calculator.js"></script>
<script src="../../register/register.js"></script>
</head>

<body class="BlueTile">
<a name="top"></a>

<table class="Max0">
<tr>

<td style="width:240px; text-align=left">
<div id="calcly" style="position:relative; width:240px">
  <script>document.write(calc());</script>
</div>
</td>

</tr>


<script>
// Form script

var f=document.frm;
function setpar(calcwidth, calcheight, calcborderwidth, calcspacing,
		calcdispwidth, calcdispheight, calcdispfont, calcdispmargin,
		calcbuttonwidth, calcbuttonheight, calcbuttonfont, calcbuttonmargin) {
  f.calcwidth.value=calcwidth;
  f.calcheight.value=calcheight;
  f.calcborderwidth.value=calcborderwidth;
  f.calcspacing.value=calcspacing;
  f.calcdispheight.value=calcdispheight;
  f.calcdispwidth.value=calcdispwidth;
  f.calcdispfont.value=calcdispfont;
  f.calcdispmargin.value=calcdispmargin;
  f.calcbuttonwidth.value=calcbuttonwidth;
  f.calcbuttonheight.value=calcbuttonheight;
  f.calcbuttonfont.value=calcbuttonfont;
  f.calcbuttonmargin.value=calcbuttonmargin;
}

// OnClick calls
function setp(n) {
  switch (n) {
    case 0: setpar(120, 180, 0, 1,
	140, 25, "bold 9pt 'Courier New', Courier, mono", 3,
	16, 16, "bold 9pt Arial, Helvetica, sans-serif", 3);
	break;
    case 1: setpar(90, 100, 1, 1,
	85, 20, "8pt 'Courier New', Courier, mono", 1,
	18, 18, "7pt Arial, Helvetica, sans-serif", 0);
	break;
    case 2: setpar(150, 200, 3, 0,
	150, 50, "bold 24pt 'Courier New', Courier, mono", 5,
	35, 35, "bold 14pt Arial, Helvetica, sans-serif", 0);
	break;
    case 3: setpar(170, 260, 15, 2,
	160, 45, "bold 20pt 'Courier New', Courier, mono", 5,
	30, 30, "bold 10pt Arial, Helvetica, sans-serif", 4);
	break;
    case 4: setpar(240, 290, 0, 0,
	240, 50, "bold 24pt 'Courier New', Courier, mono", 5,
	50, 50, "bold 18pt Arial, Helvetica, sans-serif", 5);
	break;
    case 5: setpar(240, 290, 4, 0,
	240, 50, "bold 30px, Times, serif", 5,
	50, 50, "30px, Times, serif", 5);
	break;
  }
}

// Show default values at startup
setp(0);

// Reload
function update() {
  calcwidth=parseInt(f.calcwidth.value);
  calcheight=parseInt(f.calcheight.value);
  calcborderwidth=parseInt(f.calcborderwidth.value);
  calcspacing=parseInt(f.calcspacing.value);
  calcdispwidth=parseInt(f.calcdispwidth.value);
  calcdispheight=parseInt(f.calcdispheight.value);
  calcdispfont=f.calcdispfont.value;
  calcdispmargin=parseInt(f.calcdispmargin.value);
  calcbuttonwidth=parseInt(f.calcbuttonwidth.value);
  calcbuttonheight=parseInt(f.calcbuttonheight.value);
  calcbuttonfont=f.calcbuttonfont.value;
  calcbuttonmargin=parseInt(f.calcbuttonmargin.value);
  setlyHTML(findobj('calcly'), calc());
}

</script>

</body>
</html>



le fichier javascript à placer dans le même dossier :

// Parameters
var calcwidth=220;
var calcheight=240;
var calcborderwidth=1;
var calcspacing=2;

var calcdispheight=50;
var calcdispwidth=210;
var calcdispfont="bold 24pt 'Courier New', Courier, mono";
var calcdispmargin=5;

var calcbuttonheight=35;
var calcbuttonwidth=35;
var calcbuttonfont="bold 14pt Arial, Helvetica, sans-serif";
var calcbuttonmargin=5;


// Generator functions


// Display
function calcdisp() {
  return(
"<td colspan=4 align='center' valign='middle'"+
"width='"+calcwidth+"' "+
"height='"+calcdispheight+"' "+
"style='text-align:center; vertical-align:middle;"+
"width:"+calcwidth+"; "+
"height:"+calcdispheight+"'>"+
  "<input name='display' type='Text' value='0' "+
  "style=\"font: "+calcdispfont+"; "+
  "text-align: right; "+
  "height: "+(calcdispheight-2*calcdispmargin)+"px; "+
  "width: "+(calcdispwidth-2*calcdispmargin)+"px;\""+
"</td>"
  );
}

// One button
function calcbutton(value, action) {
  return(
"<td align='center' valign='middle' "+
"width='"+(calcwidth/4)+"' "+
"height='"+((calcheight-calcdispheight)/4)+"' "+
"style='text-align:center; vertical-align:middle;"+
"width:"+(calcbuttonwidth+2*calcbuttonmargin)+"; "+
"height:"+(calcbuttonheight+2*calcbuttonmargin)+"'>"+
  "<input type='Button' "+
  "value='"+value+"' "+
  "onClick=\""+action+"\" "+
  "style=\"font: "+calcbuttonfont+"; "+
  "margin: 0px 0px; "+
  "height: "+calcbuttonheight+"px; width: "+calcbuttonwidth+"px\">"+
"</td>"
  );
}

// tr
function calctr(s) {
  return("<tr>"+s+"</tr>");
}

// Table+form
function calctable(s) {
  return(
"<form name='calckeypad'>"+
"<table border='"+calcborderwidth+"' align='center' valign='middle' cellpadding=0 cellspacing='"+calcspacing+"' "+
"width='"+(calcwidth+2*calcborderwidth)+"' "+
"height='"+(calcheight+2*calcborderwidth)+"' "+
"style='text-align=center; vertical-align:middle; "+
"border-spacing:"+calcspacing+"; "+
"width:"+(calcwidth+2*calcborderwidth)+"; "+
"height:"+(calcheight+2*calcborderwidth)+"'"+
">"+
s+
"</table>"+
"</form>"
  );
}


// Create calculator
function calc() {
  return(calctable(
  calctr(calcdisp())+
  calctr(
    calcbutton("C", "calcclear()")+
    calcbutton("CE", "calcclearentry()")+
    calcbutton("+/-", "calcneg()")+
    calcbutton("%", "calcpercent()")
  )+
  calctr(
    calcbutton("7", "calcnumpressed(7)")+
    calcbutton("8", "calcnumpressed(8)")+
    calcbutton("9", "calcnumpressed(9)")+
    calcbutton("/", "calcoperation('/')")
  )+
  calctr(
    calcbutton("4", "calcnumpressed(4)")+
    calcbutton("5", "calcnumpressed(5)")+
    calcbutton("6", "calcnumpressed(6)")+
    calcbutton("*", "calcoperation('*')")
  )+
  calctr(
    calcbutton("1", "calcnumpressed(1)")+
    calcbutton("2", "calcnumpressed(2)")+
    calcbutton("3", "calcnumpressed(3)")+
    calcbutton("-", "calcoperation('-')")
  )+
  calctr(
    calcbutton("0", "calcnumpressed(0)")+
    calcbutton(".", "calcdecimal()")+
    calcbutton("=", "calcoperation('=')")+
    calcbutton("+", "calcoperation('+')")
  )));
}

// Insert calculator
//document.write(calc());


// Calculator functions

// Module-level variables
var calcprev=0;        // calcprevious number (operand) awaiting operation
var calcfnew=false;    // Flag to indicate a new number (operand) is being entered
var calcop="";         // Pending operation waiting for completion of second operand

// Set display
function calcsetdisplay(d) {
  document.calckeypad.display.value=d;
  document.calckeypad.display.align="center"; // NS bug fix
}

// Get display
function calcgetdisplay() {
  return(document.calckeypad.display.value);
}

// Number button pressed
function calcnumpressed(num) {
  if (calcfnew) {
    calcsetdisplay(num);
    calcfnew=false;
  } else {
    if (calcgetdisplay()=="0") {
      calcsetdisplay(num);
    } else {
      calcsetdisplay(calcgetdisplay()+num);
    }
  }
}

// An operation key pressed
function calcoperation(key){
  if (calcfnew && calcop!="="){
    // User is hitting op keys repeatedly, so don't do anything
  } else {
    calcfnew=true;
    if ('+'==calcop){
      calcprev+=parseFloat(calcgetdisplay());
    } else if ('-'==calcop){
      calcprev-=parseFloat(calcgetdisplay());
    } else if ('/'==calcop){
      calcprev/=parseFloat(calcgetdisplay());
    } else if ('*'==calcop){
      calcprev*=parseFloat(calcgetdisplay());
    } else {
      calcprev=parseFloat(calcgetdisplay());
    }
    calcsetdisplay(calcprev);
    calcop=key;
  }
}

// Decimal point button pressed
function calcdecimal() {
  if (calcfnew) {
    calcsetdisplay("0.");
    calcfnew=false;
  } else {
    if (calcgetdisplay().indexOf(".")==-1) {
      calcsetdisplay(calcgetdisplay()+".");
    }
  }
}

// CE button pressed
function calcclearentry() {
  // Remove current number and reset state
  calcsetdisplay("0");
  calcfnew=true;
}

// C button pressed
function calcclear() {
  // Clear previous operand and pending operation, and clear display
  calcprev=0;
  calcop="";
  calcclearentry();
}

// +/- button pressed
function calcneg() {
  calcsetdisplay(-parseFloat(calcgetdisplay()));
}

// % button pressed
function calcpercent() {
  calcsetdisplay(parseFloat(calcgetdisplay())/100*parseFloat(calcprev));
}




Voilà.
Source :

http://www.propix.hu/www/Calculator/Calculator.html

@ pluche.
Ajouter un commentaire
Ce document intitulé « HTML : 1 background dans 1 tableau » issu de CommentCaMarche (www.commentcamarche.net) est mis à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de cette page, dans les conditions fixées par la licence, tant que cette note apparaît clairement.
Dossier à la une
Passage au tout numérique : quel coût pour les particuliers ?