Allora ragazzi..una medaglia al valore a chi riesce a farmi andare lo script. Praticamente la parte in causa e' la funzione javascript "change()". E' tutta giusta, i nomi ecc, l'ho provata anche su altre pagine prendendo da questo codice solo il necessario, ossia la form e la function change.
Si tratta di una semplice funzione che in base ai 2 valori della select abilita o disabilita gli input.
Dopo una mattinata di smanettamento sono arrivato a dire che in tutto sto codice c'e' qualcosa che ostacola questa cosa... piu esattamente secondo me sono i div che ho usato per la tab dialog... ho notato che se il codice della form lo metto fuori dalla TAB DIALOG (il menu a tendina) funziona perfettamente...please help me...spero di eesermi spiegato bene.
ecco il codice
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SimplytheBest DHTML tabbed notes script</title>
<link rel = "stylesheet" type = "text/css" href = "../css/hyperlife.css">
<meta name="keywords" content="DHTML scripts, tab, notes, messages">
<meta name="keywords" content="DHTML scripts, tabbed notes, tab, notes, dhtml script, javascript">
<meta name="description" content="Simply the Best DHTML scripts and javascripts: tabbed notes.">
<meta name="target" content="DHTML scripts, tabbed notes">
<meta name="copyright" content="copyright 1997-2005 SimplytheBest.net">
<meta name="revisit-after" content="14 days">
<meta name="robots" content="all">
<link rel="stylesheet" href="../scripts.css" type="text/css">
<style>
<!--
.conts { visibility: hidden }
.tab { font-family: Verdana; font-size: 8pt; font-weight: normal; text-align: center;
border-left: thin solid #e0e0e0; border-right: thin solid gray;
border-top: thin solid #e0e0e0;
cursor: hand;
}
.selTab { font-family: Verdana; font-size: 8pt; font-weight: bold; text-align: center;
border-left: thin solid #000080;
border-right: thin solid #000080;
border-top: thin solid #000080;
cursor: hand;
}
-->
</style>
<script language = "javascript" type="text/javascript">
function change()
{
var select = document.theForm.dhcp.value;
if(select=="yes")
{
document.theForm.hostName.disabled = true;
document.theForm.ipAddress.disabled = true;
document.theForm.gateway.disabled = true;
document.theForm.dns1.disabled = true;
document.theForm.dns2.disabled = true;
document.theForm.macAdd.disabled = true;
document.theForm.subnet.disabled = true;
}
else
{
document.theForm.hostName.disabled = false;
document.theForm.ipAddress.disabled = false;
document.theForm.gateway.disabled = false;
document.theForm.dns1.disabled = false;
document.theForm.dns2.disabled = false;
document.theForm.subnet.disabled = false;
document.theForm.macAdd.disabled = false;
}
}
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
//a public function that the container uses to pass in values for the labels
function public_Labels(label1, label2, label3, label4, label5, label6, label7){
document.getElementById("t1").innerText = label1;
document.getElementById("t2").innerText = label2;
document.getElementById("t3").innerText = label3;
document.getElementById("t4").innerText = label4;
document.getElementById("t5").innerText = label5;
document.getElementById("t6").innerText = label6;
document.getElementById("t7").innerText = label7;
}
//a public function that the container uses to pass in values for the card containers
function public_Contents(contents1, contents2, contents3, contents4, contents5, contents6, contents7){
document.getElementById("t1Contents").innerHTML = contents1;
document.getElementById("t2Contents").innerHTML = contents2;
document.getElementById("t3Contents").innerHTML = contents3;
document.getElementById("t4Contents").innerHTML = contents4;
document.getElementById("t5Contents").innerHTML = contents5;
document.getElementById("t6Contents").innerHTML = contents6;
document.getElementById("t7Contents").innerHTML = contents7;
init();
}
//sets the default display to tab 1
function init(){
document.getElementById("tabContents").innerHTML = document.getElementById("t1Contents").innerHTML;
}
//this is the tab switching function
var currentTab;
var tabBase;
var firstFlag = true;
function changeTabs(tabID){
if(firstFlag == true){
currentTab = document.getElementById("t1");
tabBase = document.getElementById("t1base");
firstFlag = false;
}
if(document.getElementById(tabID).className == "tab"){
currentTab.className = "tab";
tabBase.style.backgroundColor = "white";
currentTab = document.getElementById(tabID);
tabBaseID = currentTab.id + "base";
tabContentID = currentTab.id + "Contents";
tabBase = document.getElementById(tabBaseID);
tabContent = document.getElementById(tabContentID);
currentTab.className = "selTab";
tabBase.style.backgroundColor = "";
document.getElementById("tabContents").innerHTML = tabContent.innerHTML;
}
}
</SCRIPT>
</head>
<body onload="init()" text="#000000" link="#0000A0" vlink="#0000A0" alink="#0000A0" topmargin="10" leftmargin="10" marginheight="10" marginwidth="10">
<!-- DHTML scripts, tabbed notes script -->
<!-- Script start -->
<table bgcolor="#FFA500" cellpadding="0" cellspacing="0" style="HEIGHT: 500px; WIDTH: 800px" class="body" ID="Table1">
<tbody>
<tr>
<td class="selTab" onclick="changeTabs('t1')" height="25" id="t1">TwineXp</td>
<td class="tab" onclick="changeTabs('t2')" id="t2">Network</td>
<td class="tab" onclick="changeTabs('t3')" id="t3">Emulatore</td>
<td class="tab" onclick="changeTabs('t4')" id="t4">Utenti</td>
</tr>
<tr>
<td id="t1base" style="BORDER-LEFT: gray thin solid; HEIGHT: 1px"></td>
<td id="t2base" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></td>
<td id="t3base" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></td>
<td id="t4base" style="BACKGROUND-COLOR: white; HEIGHT: 1px"></td>
</tr>
<tr>
<td colspan="7" height="*" id="tabContents" style="BORDER-BOTTOM: gray thin solid; BORDER-LEFT: gray thin solid; BORDER-RIGHT: gray thin solid"> </td>
</tr>
</tbody>
</table>
</div>
<div class="conts" id="t1Contents" style="width: 500; height: 10">
</div>
<div class="conts" id="t2Contents" style="width: 459; height: 120">
<form action = "" method = "post" name = "theForm">
<table cellspacing="5" cellpadding="5" border = "1" align = "center" width = "380" bgcolor="#ffffff">
<tr>
<td width = "150" align = "center"><img src="TMimagesAlt/net.bmp" border="0"></td>
<td>Ip config</td>
</tr>
<tr>
<td>Dhcp :</td>
<td>
<select name = "dhcp" onChange = "change();">
<option value = "no">no</option>
<option value = "yes">yes</option>
</select>
</td>
</tr>
<tr>
<td>Host Name:</td>
<td><input type = "text" name = "hostName"></td>
</tr>
<tr>
<td>IP Address:</td>
<td><input name="ipAddress" type="text"></td>
</tr>
<tr>
<td>Subnet Mask :</td>
<td><input name="subnet" type="text" ></td>
</tr>
<tr>
<td>Gateway :</td>
<td><input name="gateway" type="text" ></td>
</tr>
<tr>
<td>Mac Address :</td>
<td><input name="macAdd" type="text"></td>
</tr>
<tr>
<td>Dns primary :</td>
<td><input name="dns1" type="text" ></td>
</tr>
<tr>
<td>Dns secondary :</td>
<td><input name="dns2" type="text" ></td>
</tr>
<tr>
<td align = "center" colspan ="2">
<table cellspacing="5" cellpadding="5" align ="center">
<tr>
<td><input type="submit" value="OK"></td>
<td><input type="reset" value="Cancel"></td>
<td><input type="submit" value="Help"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
<div class="conts" id="t3Contents" style="width: 460; height: 38">
<table valign = "top" align = "center" width = "700" >
<tr>
<td width = "150" colspan ="2">
<img src = "TMimagesAlt/spacer.gif" height = "20">
<table align = "center" valign = "top" cellspacing = "10" width = "300">
<tr>
<td><a href = "http://www.google.it" target = "pippo">Open</a></td>
<td><a href = "http://www.google.it" target = "pippo">Close</a></td>
<td><a href = "addConnHost.php" target = "pippo"><img src ="TMimagesAlt/addConn32.bmp" alt = "add connection" border = "0"></a></td>
<td><a href = "addSessionDisp.php" target = "pippo"><img src ="TMimagesAlt/addSession32.bmp" alt = "add session" border = "0"></a></td>
<td><a href = "http://www.google.it" target = "pippo"><img src ="TMimagesAlt/delete.bmp" alt = "delete" border = "0"></a></td>
<td><a href = "http://www.google.it" target = "pippo"><img src ="TMimagesAlt/proprieties.bmp" alt = "proprieties" border = "0"></a></td>
<td><a href = "userList.php" target = "pippo"><img src ="TMimagesAlt/user.bmp" alt = "user list" border = "0"></a></td>
</tr>
<table>
</td>
</tr>
<tr>
<td valign = "top">
<iframe src = "admin.php" width = "200" height = "400">
</iframe>
</td>
<td valign = "top">
<iframe src = "defaultFrameDX.php" width = "500" height = "400" name = "pippo">
</iframe>
</td>
</tr>
</table>
</div>
<div class="conts" id="t4Contents" style="width: 460; height: 88">
<p align="center" class="body"><b>Putting Information On The Tabs<br>
You can change any text, add tabs and much more.</b></p>
<p align="center" class="body"><b><font color="#000080">Continue to
Tab 5...</font></b></p>
</div>
<div class="conts" id="t5Contents" style="width: 460; height: 37">
<p align="center" class="body"><b>And so on..</b></p>
</div>
<div class="conts" id="t6Contents" style="width: 460; height: 37">
<p align="center" class="body"><b>And so on..</b></p>
</div>
<div class="conts" id="t7Contents" style="width: 460; height: 37">
<p align="center" class="body"><b>
Scroll a little down the page for instructions!</b></p>
</div>
<!-- Script end -->
</body>
</html>
ed ecco qui il codice interessato (copiato e incollato per mostrarvi che funziona)
N.B. non ditemi come altri forum...."'e' ma hai 2 form con lo stesso nome "----- Quello qua sotto e' solo il codice che ho usato sopra. Prendete solo la parte sotto, la metete in una pagina e vedrete che fa quello che il codice sopra non fa.
<script language = "javascript" type="text/javascript">
function change()
{
var select = document.theForm.dhcp.value;
if(select=="yes")
{
document.theForm.hostName.disabled = true;
document.theForm.ipAddress.disabled = true;
document.theForm.gateway.disabled = true;
document.theForm.dns1.disabled = true;
document.theForm.dns2.disabled = true;
document.theForm.macAdd.disabled = true;
document.theForm.subnet.disabled = true;
}
else
{
document.theForm.hostName.disabled = false;
document.theForm.ipAddress.disabled = false;
document.theForm.gateway.disabled = false;
document.theForm.dns1.disabled = false;
document.theForm.dns2.disabled = false;
document.theForm.subnet.disabled = false;
document.theForm.macAdd.disabled = false;
}
}
</script>
<form action = "" method = "post" name = "theForm">
<table cellspacing="5" cellpadding="5" border = "1" align = "center" width = "380" bgcolor="#ffffff">
<tr>
<td width = "150" align = "center"><img src="TMimagesAlt/net.bmp" border="0"></td>
<td>Ip config</td>
</tr>
<tr>
<td>Dhcp :</td>
<td>
<select name = "dhcp" onChange = "change();">
<option value = "no">no</option>
<option value = "yes">yes</option>
</select>
</td>
</tr>
<tr>
<td>Host Name:</td>
<td><input type = "text" name = "hostName"></td>
</tr>
<tr>
<td>IP Address:</td>
<td><input name="ipAddress" type="text"></td>
</tr>
<tr>
<td>Subnet Mask :</td>
<td><input name="subnet" type="text" ></td>
</tr>
<tr>
<td>Gateway :</td>
<td><input name="gateway" type="text" ></td>
</tr>
<tr>
<td>Mac Address :</td>
<td><input name="macAdd" type="text"></td>
</tr>
<tr>
<td>Dns primary :</td>
<td><input name="dns1" type="text" ></td>
</tr>
<tr>
<td>Dns secondary :</td>
<td><input name="dns2" type="text" ></td>
</tr>
<tr>
<td align = "center" colspan ="2">
<table cellspacing="5" cellpadding="5" align ="center">
<tr>
<td><input type="submit" value="OK"></td>
<td><input type="reset" value="Cancel"></td>
<td><input type="submit" value="Help"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
Per favore aiutatemi
grazie