problema JS div is null

ispooky83

Nuovo Utente
28 Gen 2009
3
0
0
Ciao a tutti,
premetto che non sono un genio di javascript ma devo risolvere un problema che proprio non mi va giu.
Nel codice javascript sottostante serve per ridimensionare un div e funziona alla perfezione su tutti i browser.

Codice:
      var divscrollContent = document.getElementById("mainTable");
       var htmlheightscrollContent= content_height-"60";
       var htmlWidthscrollContent= content_Width-"200";
       divscrollContent.style.height = htmlheightscrollContent + "px";     
       divscrollContent.style.width = htmlWidthscrollContent + "px";

Il fatto è che FF nella console degli errori mi riporta
"divscrollContent is null"

sapreste aiutarmi per eliminare questo errore maledetto???
ciao
grazie
 

ispooky83

Nuovo Utente
28 Gen 2009
3
0
0
Innanzi tutto grazie del benvenuto,

;-)

carico il file JS subito dopo l'header e brima del body.
Nel body, nell'onload richiamo una funzione di cui ho bisogno per passare le dimensioni alla "maintable".
Codice:
<body onload="javascript:calcHeight();" ...


Il codice della funzione praticamente è questo
Codice:
//trova l'altezza della pagina function calcHeight(){
var content_Width=getBrowserWidth( );
var content_height=getBrowserHeight( );
if (BrowserDetect.browser=="Explorer"){         myGetElementById('leftMenu').style.height=content_height;
myGetElementById('mainTable').style.height=content_height-"54";
myGetElementById('mainTable').style.width=content_Width-"197"; 
myGetElementById('divInterno').style.height=content_height-"130"; 
myGetElementById('masterBody').style.marginTop="0px";    
myGetElementById('DivTest').style.height=content_height-"60";
myGetElementById('DivTest').style.width=content_Width-"200";
}
 if(BrowserDetect.browser=="Firefox"){
var divleft = document.getElementById("leftMenu");
var divMainTable = document.getElementById("mainTable");
var divMasterBody = document.getElementById("masterBody");
var htmlheightMainTable= content_height-"60";
divMainTable.style.height = htmlheightMainTable + "px";
divMasterBody.style.marginTop= "0px"; 
var divscrollContent = document.getElementById("mainTable");
var htmlheightscrollContent= content_height-"60";
var htmlWidthscrollContent= content_Width-"200";
divscrollContent.style.height = htmlheightscrollContent + "px";
divscrollContent.style.width = htmlWidthscrollContent + "px";
}
if (BrowserDetect.browser=="Safari"){
var divleft = document.getElementById("leftMenu");
var divInt = document.getElementById("divInterno");
var divMainTable = document.getElementById("mainTable");
var htmlheightInterno= content_height-"170";
divInt.style.height = htmlheightInterno + "px";
var htmlheightMainTable= content_height-"80";
divMainTable.style.height = htmlheightMainTable + "px"; 
mainTable.style.width=content_Width-"197" + "px";
masterBody.style.marginTop="-16px";
//alert(content_Width);
} 
}
window.onresize=function() {
calcHeight(); 
}


E la mainTable è dichiarata in questo modo
Codice:
<div id="mainTable" style="overflow:auto;">

non so...per me è tutto regolare infatti funziona...ma questo problema nella console FF devo risolverlo!
Quale sarà il problema???
Grazie mille
 
Ultima modifica:
Discussioni simili
Autore Titolo Forum Risposte Data
ANDREA20 [HTML] problema con i div HTML e CSS 10
E [Javascript] problema con margine quando viene mostrato div Javascript 0
D [HTML] Problema con Dreamweaver; 1) tabella con larghezza 100% 2) Immagine che si adatta a Div HTML e CSS 28
M Problema con ciclo foreach per chiusura apertura div in base al numero di record in database PHP 1
S Problema scorrimento DIV Javascript 6
S Problema scorrimento DIV senza scrollbar HTML e CSS 4
D problema sovrapposizione div in sito responsive HTML e CSS 4
C Problema div HTML e CSS 2
C Problema centraggio box div HTML e CSS 2
gandalf1959 problema nel posizionamento di un div HTML e CSS 1
M Problema altezza div automatica HTML e CSS 12
H Problema blocco div in rilievo jQuery 3
H Problema riguardo a contenitori div jQuery 2
E problema posizionamento div HTML e CSS 1
D Problema con lo scroll della pagina e del div position:fixed HTML e CSS 0
D Problema con sovrapposizione DIV HTML e CSS 2
P Problema con hover div jQuery 2
asevenx Problema Dreamweaver "impossibile individuare i file correlati dinamicamente..." e con i <div> HTML e CSS 1
A problema spazi tra i Div quando nello zoom in in Chrome o dispositivi mobili HTML e CSS 1
M Problema affiancamento div HTML e CSS 4
A Problema livelli tra div e script js Javascript 7
danlupo Problema Div OverFlow ed Height HTML e CSS 0
V problema refresh di un div Javascript 4
V problema riguardante l'apertura di pagine e passaggio dati nei div Javascript 0
V problema allineamento div HTML e CSS 1
U Problema java con <div> Javascript 0
N problema con div width: 100% HTML e CSS 0
S problema con div a scomparsa jquery jQuery 0
B Problema DIV e IMMAGINI HTML e CSS 6
SolidSnake4 Problema div annidati HTML e CSS 1
D problema div con internt explorer HTML e CSS 10
N [PHP+HTML+CSS] Problema con un div HTML e CSS 4
T problema posizionamento div HTML e CSS 2
F Problema Menu/Div Webdesign e Grafica 9
Nik Posizionare un div (contenente una tabella) al centro, problema con mozilla HTML e CSS 0
B Problema Strano Su DIV. mi scompare tutto!! HTML e CSS 8
Freshtaste Problema con il background dei div HTML e CSS 5
F [CSS] Problema con IE e div fixed HTML e CSS 2
gladenko CSS e DIV problema di dimensionamento HTML e CSS 3
Eugene Tre div all'interno di un altro div - problema IE HTML e CSS 2
I Sto progettando nuovi siti utilizzando bootstrap e devo dire funziona bene, l'unico problema e la maschera -moz- HTML e CSS 0
K Problema form update PHP 2
O problema con dvr dahua xvr5116 IP Cam e Videosorveglianza 0
S Problema nel ciclare un json Javascript 0
G Problema con Xampp Web Server 1
andrea barletta Problema con miniature comandi Photoshop 0
I problema con alice Posta Elettronica 0
K Problema Inner join PHP 1
F firefox problema http Linux e Software 0
N Problema con position absolute e overflow HTML e CSS 4

Discussioni simili