Problema Interpretazione javascript con mozilla

mercoledì 18 marzo 2009 - 13.29

pe_87 Profilo | Newbie

Buongiorno a tutti
Mi sono appena iscritto perche ho un problema con i Javascript.
Di seguito il Javascript:

var sizeDragObj = ToolMan.drag();
var coords = ToolMan.coordinates();
var ds;
var detpan;
var dpan;
var table;
var base;
var grp;
var maxdpanelSize;
var sizeDragMove = function(dragEvent) {
var cw = coords._size(detpan);
var ccw = coords._size(dpan);
var is = coords.topLeftPosition(dragEvent.group.element)
var res0 = (cw.x-is.x);
var res1 = (ccw.x+is.x);

detpan.style["width"] = res0+"px";
setCookie("EventsEditorDetPanSize", res0);
dpan.style["width"] = res1+"px";
}
var fixedTransform = function (coordinate, dragEvent) {
if (!base)
base = coordinate;

var cy = base.y
var cx = coordinate.x
var deltax = cx-base.x;
var cw = coords._size(detpan);
var ccw = coords._size(dpan);
if ((cw.x < 200) && (deltax>0))
cx = base.x;
else if ((ccw.x < 200) && (deltax<0))
cx = base.x;
else
base.x = coordinate.x;

window.status = cw.x + " " + deltax;

return coords.create(cx, cy)
}
autoPanelSize = function() {
sizeDragObj = ToolMan.drag();
coords = ToolMan.coordinates();
ds = document.getElementById("SizeDrag");
detpan = document.getElementById("<%=DetailsPanel.ClientID%>");
dpan = document.getElementById("<%=dpanel.ClientID%>");
table = document.getElementById("<%=Table1.ClientID%>");
var detpanSize = getCookie("EventsEditorDetPanSize");
if (!detpanSize)
detpanSize=200;
var psize = coords._size(table.parentElement);
var tableSize = (psize.x-16);
if (detpanSize>tableSize)
detpanSize=200;
table.style.width = tableSize + "px";
detpan.style.width = detpanSize + "px";
dpan.style.width = (tableSize-detpanSize) + "px";
maxdpanelSize = tableSize-detpanSize-200;
grp = sizeDragObj.createSimpleGroup(ds);
grp.addTransform(fixedTransform);
grp.register('dragmove', sizeDragMove);
}

addLoadEvent(autoPanelSize);


IE lo interpreta alla perfezione..firefox no..
Xke??
Grazie in anticipo a tutti coloro ke risponderanno..

balfaz Profilo | Expert

Pima cosa : BENVENUTO!!!
Seconda cosa: Non è la stanza giusta, dovresti averlo fatto in questa sezione http://www.dotnethell.it/forum/Javascript-CSS-XHTML-DHTML.aspx
Terza cosa: già che ci siamo, qual'è il problema in specifico ?



Dove troverai sempre una mano disposta ad aiutarti è nell'estremo del tuo proprio braccio

pe_87 Profilo | Newbie

Innazitutto grazie per avermi risposto e per avermi chiarito un paio di cose....
comunque,il problema è che il "sizedrag" è un <div>,con IE riesco a spostarlo a sinistra,mentre con firefox no.
Per essere piu chiaro,questa è la pagina html:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="OccEvents.ascx.vb"
Inherits="SDS.OccEvents" %>
<%@ Register TagPrefix="uc1" TagName="EvtTree" Src="EvtTree.ascx" %>
<link href="../style.css" type="text/css" rel="stylesheet" />
<link href="../Resources/nicetitle.css" type="text/css" rel="stylesheet" />
<link href="../Resources/help.css" type="text/css" rel="stylesheet" />

<script language="JavaScript" src="../Resources/gedit.js" type="text/javascript"></script>

<script language="JavaScript" src="../Resources/wz_jsgraphics.js" type="text/javascript"></script>

<KiteControls:JavascriptTag ID="jsctl" runat="server" />
<asp:Table ID="Table2" CssClass="menuboxheaderbody" BackImageUrl="~/images/testata_body.gif"
BorderStyle="Solid" BorderColor="Black" Width="100%" runat="server" Style="margin-bottom: 7px;
border-bottom: 0px" CellPadding="0" CellSpacing="0" BorderWidth="1px">
<asp:TableRow>
<asp:TableCell Width="100%" RowSpan="2" Height="22" VerticalAlign="Middle" HorizontalAlign="Left"
CssClass="headpage"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table Width="630px" Height="100%" runat="server" ID="Table1" CellPadding="0"
CellSpacing="0">
<asp:TableRow>
<asp:TableCell Width="100%" Height="22px" ColumnSpan="0" CssClass="toolbar1 horizontaltoolbar"
HorizontalAlign="Left">
<ul class="toolbar horizontaltoolbar" id="horizontaltoolbar">
<li class="button"><a href="#" onclick="stopJoin();">
<img id="selectTool" class="inactive" title="Select Events" runat="server" src="~/Resources/toolbar/arrow.png"
border="0" alt="." /></a></li>
<li class="button">
<%If LockStatus = SDSLibraries.OccPair.LockState.LOCKED_BY_ME Then%>
<a href="#" onclick="setTool(DragCTL_joinTool);startJoin();" rel="stylesheet">
<img id="joinTool" class="inactive" title="Creates a new Relation between events"
runat="server" src="~/Resources/toolbar/eventjoin.png" border="0" alt="." /></a><%End If%></li>
<li class="separator"></li>
<li class="button">
<%If LockStatus = SDSLibraries.OccPair.LockState.LOCKED_BY_ME Then%>
<a href="#" onclick="<%=GetCommandPBReference(NEWEVENT_COMMAND)%>;" rel="stylesheet">
<img title="Create a new Event" runat="server" src="~/Resources/toolbar/newevent.png"
border="0" alt="." /></a><%End if%></li>
<li class="button">
<%If LockStatus = SDSLibraries.OccPair.LockState.LOCKED_BY_ME Then%>
<a href="#" onclick="if (confirm_action('Do you really want to delete the select elements?')) <%=GetCommandPBReference(DELETESELECTION_COMMAND)%>;" rel="stylesheet">
<img title="Delete selecte elements" runat="server" src="~/Resources/toolbar/delete.png"
border="0" alt="." /></a><%End if%></li>
<li class="separator"></li>
<li class="button"><a href="#" onclick="switchRefresh();" rel="stylesheet">
<img id='junctionsTool' class="inactive" title="Switch relation refresh while dragging an event"
runat="server" src="~/Resources/toolbar/reload.png" border="0" alt="." /></a></li>
<li class="button"><a href="#" onclick="zoomIn();" rel="stylesheet">
<img id='zoomP' title="Zoom In" runat="server" src="~/Resources/toolbar/zoomin.png"
border="0" alt="." /></a></li>
<li class="button"><a href="#" onclick="zoom(100);" rel="stylesheet">
<img id='zoom100' title="Zoom 100%" runat="server" src="~/Resources/toolbar/zoom100.png"
border="0" alt="." /></a></li>
<li class="button"><a href="#" onclick="zoomOut();" rel="stylesheet">
<img id='zoomM' runat="server" title="Zoom Out" src="~/Resources/toolbar/zoomout.png"
border="0" alt="." /></a></li>
<asp:TextBox Width="0" Height="0" Style="visibility: hidden" runat="server" ID="PositionContainer"></asp:TextBox>
<asp:Button Width="0" Height="0" Style="visibility: hidden" runat="server" ID="CommandButton">
</asp:Button>
</ul>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Height="100%">
<div id="cpanel" style="z-index: -101; overflow: auto; position: absolute; width: 100%;
height: 100%;">
</div>
<asp:Panel runat="server" ID="dpanel" Style="z-index: auto; overflow: hidden; width: 100%; height: 100%;"><%--background-color: Blue;--%>
</asp:Panel>
</asp:TableCell>
<asp:TableCell Height="100%" VerticalAlign="Top">
<div id="SizeDrag" style="z-index:auto;width:5px;height:100%;cursor:w-resize;float:left;background-color:#AAAAAA"><%--controllare il valore di z-index--%>
<script language="javascript" type="text/javascript" >
<!--
var sizeDragObj = ToolMan.drag();
var coords = ToolMan.coordinates();
var ds;
var detpan;
var dpan;
var table;
var base;
var grp;
var maxdpanelSize;
var sizeDragMove = function(dragEvent) {
var cw = coords._size(detpan);
var ccw = coords._size(dpan);
var is = coords.topLeftPosition(dragEvent.group.element)
var res0 = (cw.x-is.x);
var res1 = (ccw.x+is.x);

detpan.style["width"] = res0+"px";
setCookie("EventsEditorDetPanSize", res0);
dpan.style["width"] = res1+"px";
}
var fixedTransform = function (coordinate, dragEvent) {
if (!base)
base = coordinate;

var cy = base.y
var cx = coordinate.x
var deltax = cx-base.x;
var cw = coords._size(detpan);
var ccw = coords._size(dpan);
if ((cw.x < 200) && (deltax>0))
cx = base.x;
else if ((ccw.x < 200) && (deltax<0))
cx = base.x;
else
base.x = coordinate.x;

window.status = cw.x + " " + deltax;

return coords.create(cx, cy)
}
autoPanelSize = function() {
sizeDragObj = ToolMan.drag();
coords = ToolMan.coordinates();
ds = document.getElementById("SizeDrag");
detpan = document.getElementById("<%=DetailsPanel.ClientID%>");
dpan = document.getElementById("<%=dpanel.ClientID%>");
table = document.getElementById("<%=Table1.ClientID%>");
var detpanSize = getCookie("EventsEditorDetPanSize");
if (!detpanSize)
detpanSize=200;
var psize = coords._size(table.parentElement);
var tableSize = (psize.x-16);
if (detpanSize>tableSize)
detpanSize=200;
table.style.width = tableSize + "px";
detpan.style.width = detpanSize + "px";
dpan.style.width = (tableSize-detpanSize) + "px";
maxdpanelSize = tableSize-detpanSize-200;
grp = sizeDragObj.createSimpleGroup(ds);
grp.addTransform(fixedTransform);
grp.register('dragmove', sizeDragMove);
}

addLoadEvent(autoPanelSize);
//-->
</script>

</div>
</asp:TableCell>
<asp:TableCell Height="100%" VerticalAlign="Top">
<asp:Panel ID="DetailsPanel" runat="server" Style="overflow: auto; width: 100%; height: 100%;">
<asp:Panel runat="server" ID="EventPanel" Visible="False">
&nbsp;
<uc1:EvtTree runat="server" ID="EventTree"></uc1:EvtTree>
</asp:Panel>
</asp:Panel>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5