|
|
|
|
| |
|
0m4r |
[HTML+javascript] perchè da mozilla non funziona? |
19-02-2005 11:11 |
|
|
0m4r |
.grande:maestro.
Registered: Mar 2002
Posts: 7287 (0.88 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline
Edit | Report | IP: Logged |
[HTML+javascript] perchè da mozilla non funziona?
come da oggetto, questo è il codice:
code:
<!DOCTYPE HTML SYSTEM "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<Link rel="stylesheet" type="text/css" href="bannerDefault.css"/>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<script type="text/javascript">
function paint(){
var r = document.cp.red.value;
var g = document.cp.green.value;
var b = document.cp.blue.value;
var bw = document.cp.colorbox;
var rok = true;
var gok = true;
var bok = true;
if(0>r || r>255){
alert("RED has an INVALID value: it need to be between 0 and 255");
rok = false;
}
if(0>g || g>255){
alert("GREEN has an INVALID value: it need to be between 0 and 255");
gok = false;
}
if(0>b || b>255){
alert("BLUE has an INVALID value: it need to be between 0 and 255");
bok = false;
}
if(rok && gok && bok){
document.getElementById("colorbox").style.backgroundColor='rgb('+r+','+g+','+b+')';
}
}
function resize(){
var h = document.cp.thumbHeight.value;
var w = document.cp.thumbWidth.value;
var hok = true;
var wok = true;
if(h<50 || h>300){
alert("HEIGHT has an INVALID value: it need to be between 50 and 300");
hok = false;
}
if(w<50 || w>300){
alert("WIDTH has an INVALID value: it need to be between 50 and 300");
wok = false;
}
if(wok){
document.getElementById("colorbox").style.width=w;
alert(document.getElementById("colorbox").style.width);
document.getElementById("colorbox").style.width=w;
}
if(hok){
document.getElementById("colorbox").style.height=h+'';
}
}
</script>
</head>
<body onload="paint(), resize()">
<form method="post" action="test.html" name="cp">
<table class="gallery">
<tr>
<td colspan="2" style="font-weight:bold;">
Dimensioni Icone
</td>
</tr>
<td style="width:50%; text-align:right; border:0px solid blue">
Width :
</td>
<td style="width:50%; text-align:left; border:0px solid blue">
<input name="thumbWidth" value="250" style="border:1px solid gray" maxlength="3" size="3" onChange="resize()"> px
</td>
</tr>
<tr>
<td style="width:50%; text-align:right; border:0px solid blue">
Height :
</td>
<td style="width:50%; text-align:left; border:0px solid blue">
<input name="thumbHeight" value="150" style="border:1px solid gray" maxlength="3" size="3" onChange="resize()"> px
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="2" style="font-weight:bold;">
Background
</td>
</tr>
<tr>
<td style="width:50%; text-align:right; border:0px solid blue">
Red :
</td>
<td style="width:50%; text-align:left; border:0px solid blue">
<input name="red" value="255" style="border:1px solid gray; color:red" maxlength="3" size="3" OnKeyUp="paint()"> px
</td>
</tr>
<tr>
<td style="width:50%; text-align:right; border:0px solid blue">
Green :
</td>
<td style="width:50%; text-align:left; border:0px solid blue">
<input name="green" value="200" style="border:1px solid gray; color:green" maxlength="3" size="3" OnKeyUp="paint()"> px
</td>
</tr>
<tr>
<td style="width:50%; text-align:right; border:0px solid blue">
Blue :
</td>
<td style="width:50%; text-align:left; border:0px solid blue">
<input name="blue" value="180" style="border:1px solid gray; color:blue" maxlength="3" size="3" OnKeyUp="paint()"> px
</td>
</tr>
<tr>
<td colspan="2" style="font-weight:bold;">
</td>
</tr>
<tr>
<td colspan="2" style="font-weight:bold;">
Preview
</td>
</tr>
<tr>
<td colspan="2" align="center">
<div id="colorbox" style="border:1px solid red;">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
__________________
http://www.twitter.com/0m4r
|
19-02-2005 11:11 |
|
|
| |
|
yeah |
1) Quando, in resize(), cambi le dimensioni, oltre ... |
19-02-2005 22:17 |
|
|
yeah |
.grande:maestro.
Registered: Nov 2003
Posts: 1644 (0.21 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline
Edit | Report | IP: Logged |
1) Quando, in resize(), cambi le dimensioni, oltre al valore della variabile aggiungi "px" (es [...].width = w + "px"; )
2) Nello stile del colorbox aggiungi i parametri che cambi nel codice java script: width, height e backgroundColor e assegna valori di default
Dimmi se va
__________________
?
|
19-02-2005 22:17 |
|
|
| |
|
0m4r |
[QUOTE][i]Originally posted by yeah [/i]
... |
20-02-2005 12:36 |
|
|
0m4r |
.grande:maestro.
Registered: Mar 2002
Posts: 7287 (0.88 al dì)
Location: Düsseldorf (DE)
Corso:
Anno: ESAMI FINITI
Time Online: 49 Days, 0:42:50 [...]
Status: Offline
Edit | Report | IP: Logged |
Originally posted by yeah
1) Quando, in resize(), cambi le dimensioni, oltre al valore della variabile aggiungi "px" (es [...].width = w + "px"; )
FANTASTICO, funziona. Anche se mi sembra un'assurdità non vederlo funzionare semplicemente per l'unità di misura. Comunque ora va!
Originally posted by yeah
2) Nello stile del colorbox aggiungi i parametri che cambi nel codice java script: width, height e backgroundColor e assegna valori di default
La funziona che mi colora il <div> funzionava anche prima, quindi problema risolto gia in partenza!
Originally posted by yeah
Dimmi se va
Va!
__________________
http://www.twitter.com/0m4r
|
20-02-2005 12:36 |
|
|
| |
|
yeah |
Perfetto :) ... |
20-02-2005 20:39 |
|
|
yeah |
.grande:maestro.
Registered: Nov 2003
Posts: 1644 (0.21 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline
Edit | Report | IP: Logged |
Perfetto
__________________
?
|
20-02-2005 20:39 |
|
|
| |
|
All times are GMT. The time now is 08:26. |
|
|
|
|
|
|
|
| |
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|