innanzitutto grazie per la risposta XinodOriginariamente inviato da Xinod
questo
var larghezza=document.getElementById("editor").width;
funziona finche' hai nel markup
<table width="640" ...>
questo
var larghezza=document.getElementById("editor").style. width;
funziona finche' hai nel markup (quindi rigorosamente nello stile in linea)
<table style="width:640px" ...>
altrimenti
var larghezza=document.getElementById("editor").offset Width;
supportato ampiamente dai browser moderni, puo' dare incongruenze in presenza di border/padding
ciao
ho provato con questo codice
ma non da risultati.. in consolle di mozilla mi ritrovoCodice PHP:<html>
<head>
<script language="javascript">
function getOff()
{
x = document.getElementById('test');
return x.offsetWidth;
}
alert('offsetWidth = ' + getOff());
</script>
</head>
<body>
<table id="test" border="1" width="100%" height="100%">
<tr>
<td>ciao mondo</td>
</tr>
<tr>
<td>ciao mondo</td>
</tr>
<tr>
<td>ciao mondo</td>
</tr>
</table>
</body>
</html>
da cosa può dipendere?Codice PHP:
Errore: x has no properties
File sorgente: [url]http://localhost/test.html[/url]
Riga: 7



Rispondi quotando