Bonjour,
J'ai essayé de mettre un fond qui s'étire dans ma page web
j'avais trouvé ca:
<SCRIPT language="JavaScript" title="image resize">
function makeIm(){
NS4=(document.layers);
IE4=(document.all);
scaleWidth = true;
scaleHeight = true;
imSRC = "fond.jpg";
if (NS4){
origWidth = innerWidth;
origHeight = innerHeight}
function reDo(){
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload()}
if (NS4) onresize = reDo;
if (IE4) onresize = reDoIE;
function reDoIE(){
imBG.width = document.body.clientWidth;
imBG.height = document.body.clientHeight}
winWid = (NS4) ? innerWidth : document.body.clientWidth;
winHgt = (NS4) ? innerHeight : document.body.clientHeight;
imStr = "<div id=elBGim"
+ " style='position:absolute;left:0;top:0;z-index:2'>"
+ "<img name='imBG' border='0' src="+imSRC;
if (scaleWidth) imStr += " width="+winWid;
if (scaleHeight) imStr += " height="+winHgt;
imStr += "></div>";
document.write(imStr)}
makeIm();
</SCRIPT>
</p>
Le fond s'étire bien.
Le problème est que si je rajoute du texte à mon body avec la fonction ci-dessous, le texte ajouté pousse l'image vers le haut au lieu de passer par dessus:
addHTML(document.body,'mon texte');
function addHTML(element, HTML) {
var o = document.createElement("htmlSection");
o.innerHTML = HTML;
element.appendChild(o)
}
voici ce que ca donne (ne pas tenir compte de la photo c'est un essaie lol)
[ Lien ]Auriez vous une solution
merci