By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,666 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,666 IT Pros & Developers. It's quick & easy.

mouseover function not work on firefox with dynamic created dropdown menu

P: 14
The following code is dynamic create dropdownmenu which data within pulled from database
However, the code work well on IE but not on Firefox. On Firefox, the whole mouseover and mouseout function din't work. what is not supported on Firefox? the javascript syntax? please help as i am not familiar with javascript. thanks in advanced. this is quite urgent.... please..

By the way hope there has somebody may help me find out why the design may not in proper way like in IE for Firefox. the padding and space between table and table all not in proper.... why is it happen? hope somebody may find out from HTML i provide here.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  Private Sub fnBindDataUser()
  4.         Dim conn As SqlConnection
  5.         Dim ds As DataSet
  6.         conn = New SqlConnection(ConfigurationManager.AppSettings("ConnectionStringTest"))
  7.         conn.Open()
  8.         Try
  9.             ds = SqlL.ExecuteDataset(conn, CommandType.Text, "SELECT * FROM tblCT")
  10.             fnCreateAddressDataGrid(ds)
  11.         Catch ex As Exception
  12.             clsCommon.MsgBox(Me, "Message", ex.Message & " msg3")
  13.             ds = Nothing
  14.         Finally
  15.             conn.Close()
  16.         End Try
  17.         dgUser.DataSource = ds
  18.         dgUser.DataBind()
  19.         dgUser.Font.Underline = False
  20.     End Sub
  21.  
  22.   Private Sub fnCreateAddressDataGrid(ByVal dsUser As DataSet)
  23.         Dim dr As DataRow
  24.         Dim boldisp As Boolean
  25.         Dim bolbgimg As Boolean
  26.         boldisp = False
  27.         bolbgimg = False
  28.         For Each dr In dsUser.Tables(0).Rows
  29.             Dim I As Integer = 0
  30.             Dim dgAddress As New DataList
  31.             Dim col As BoundColumn = New BoundColumn()
  32.             Dim tcl1 As TemplateColumn = New TemplateColumn()
  33.             Dim tcl2 As TemplateColumn = New TemplateColumn()
  34.             dgAddress.ID = "dgAddress_" & dr("CustTID").ToString
  35.             'Image
  36.             Dim btnImg As Image = New Image
  37.             Dim aImg As HtmlAnchor = New HtmlAnchor
  38.             Dim tblItem As Table = New Table
  39.             Dim tr As TableRow = New TableRow
  40.             Dim tc As TableCell = New TableCell
  41.             btnImg.ID = "bntImgAddress_" & dr("CustTID").ToString
  42.             aImg.ID = "aImgAddress_" & dr("CustTID").ToString
  43.             '  aImg.HRef = "products/product.aspx?CID=" & CID & "&cuid=" & dr("CustTID").ToString 'dr("CustTGatewayURL").ToString
  44.             aImg.HRef = dr("CustTGatewayURL").ToString
  45.             aImg.Target = "_blank"
  46.             btnImg.ImageUrl = dr("CustTImgGateway").ToString
  47.             aImg.Controls.Add(btnImg)
  48.  
  49.             If boldisp = False Then
  50.                 dgAddress.Attributes.Add("style", "display:block")
  51.                 tblItem.Attributes.Add("style", "display:block")
  52.                 aImg.Style.Value = "display:block"
  53.                 boldisp = True
  54.             Else
  55.                 dgAddress.Attributes.Add("style", "display:none")
  56.                 tblItem.Attributes.Add("style", "display:none")
  57.                 aImg.Style.Value = "display:none"
  58.             End If
  59.             col.HeaderText = "Address"
  60.             col.DataField = "Address"
  61.             dgAddress.ItemTemplate = New CreateItemTemplateLinkBtn("lnkBtn", "Message", "doLink", "lblCustTID", bolbgimg, "lblnew")
  62.             If bolbgimg = False Then
  63.                 bolbgimg = True
  64.             Else
  65.                 bolbgimg = False
  66.             End If
  67.             AddHandler dgAddress.ItemDataBound, AddressOf dgAddress_ItemDataBound
  68.             AddHandler dgAddress.ItemCommand, AddressOf dgAddress_ItemCommand
  69.  
  70.             dgAddress.DataSource = fnBindDataAddress(dr("CustTID").ToString)
  71.             dgAddress.DataBind()
  72.             dgAddress.Width = "748"
  73.             dgAddress.Height = "82"
  74.             dgAddress.ItemStyle.Width = "155"
  75.             dgAddress.ItemStyle.Wrap = True
  76.             dgAddress.ItemStyle.VerticalAlign = VerticalAlign.Top
  77.             dgAddress.ItemStyle.HorizontalAlign = HorizontalAlign.Left
  78.             dgAddress.Font.Name = "Arial"
  79.             dgAddress.Font.Size = "8"
  80.             dgAddress.RepeatLayout = RepeatLayout.Table
  81.             dgAddress.RepeatDirection = RepeatDirection.Horizontal
  82.             dgAddress.RepeatColumns = 5
  83.             dgAddress.CellPadding = "0"
  84.             dgAddress.CellSpacing = "0"
  85.             dgAddress.Style.Value = "text-align:top;"
  86.  
  87.             Dim arrColor() As String
  88.             arrColor = Split(dr("CustTTabColor").ToString, ",")
  89.  
  90.             tblItem.BackColor = System.Drawing.Color.FromArgb(arrColor(0), arrColor(1), arrColor(2))
  91.             tblItem.ID = "tblItem" & dr("CustTID").ToString
  92.             tc.Controls.Add(dgAddress)
  93.             tr.Controls.Add(tc)
  94.             tblItem.Controls.Add(tr)
  95.  
  96.             tr.Width = "748"
  97.             tr.Height = "80"
  98.             tr.Style.Value = "vertical-align:top;text-align:top;"
  99.  
  100.             tblItem.CellPadding = "0"
  101.             tblItem.CellSpacing = "0"
  102.             phAddress.Controls.Add(tblItem)
  103.             phBannerImg.Controls.Add(aImg)
  104.  
  105.         Next
  106.     End Sub
  107.  
  108.   Protected Sub dgUser_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dgUser.ItemDataBound
  109.         If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
  110.             Dim tblUser As Table = CType(e.Item.FindControl("tblUser"), Table)
  111.             Dim lblUserID As Label = CType(e.Item.FindControl("lblUserID"), Label)
  112.             Dim lnkCustType As LinkButton = CType(e.Item.FindControl("lbCustTypeName"), LinkButton)
  113.             tblUser.Attributes.Add("onmouseover", "jshow( 'tblItem" & lblUserID.Text & "','tblItem','aImgAddress_" & lblUserID.Text & "','aImgAddress_');")     
  114.             tblUser.Attributes.Add("onmouseout", "jshow( 'tblItem" & lblUserID.Text & "','tblItem','aImgAddress_" & lblUserID.Text & "','aImgAddress_');")        tblUser.BackImageUrl = CType(e.Item.FindControl("lblimg"), Label).Text
  115.         End If
  116.     End Sub
  117.  
  118.  
[HTML]
<script type="text/javascript">
function jshow(id, idname,imgid, imgidname)
{
var div = document.getElementById('div');
var child = div.childNodes;
var numchild = child.length;
var ctlname;
var obj;
var divimg = document.getElementById('divimg');
var childimg = divimg.childNodes;
var numchildimg = childimg.length;
var ctlimgname;
var objimg;

for(var i = 0; i < numchild; i++)
{
ctlname = child[i].id;
if (ctlname.indexOf(idname) >= 0)
{
child[i].style.display = 'none';
}
}
for(var j = 0; j < numchildimg; j++)
{
ctlimgname = childimg[j].id;
if(typeof ctlimgname == 'string')
{
if (ctlimgname.indexOf(imgidname) >= 0)
{
childimg[j].style.display = 'none';
}
}
}

obj = document.getElementById(id);
obj.style.display = 'block';
objimg = document.getElementById(imgid);
objimg.style.display = 'block';

}
</script>

<div id="div">
<asp:DataList ID="dgUser" Width="748px" runat="server" RepeatDirection="Horizontal" RepeatColumns="5" ItemStyle-VerticalAlign="Top" cellspacing="0" cellpadding="0" ItemStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Table runat="server" id="tblUser" style="display:block;cursor:pointer; width: 100%; font-family: Arial; font-size: 9pt; font-weight: 700; height: 30px;" cellspacing="0" cellpadding="0">
<asp:TableRow Visible="false" >
<asp:TableCell Width="100%">
<asp:Label ID="lblUserID" ForeColor="White" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CustTID")%>' ></asp:Label>
</asp:TableCell>
<asp:TableCell Width="100%">
<asp:Label ID="lblBanner" ForeColor="White" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CustTImgGateway")%>' ></asp:Label>
</asp:TableCell>
<asp:TableCell Width="100%">
<asp:Label ID="lblBannerURL" ForeColor="White" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CustTGatewayURL")%>' ></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="trCustTT" >
<asp:TableCell id="tcCustTI" ColumnSpan="3">
&nbsp;&nbsp;<asp:LinkButton ID="lbCustTName" ForeColor="White" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CustTName")%>' CommandName ="SelectCustType" CommandArgument='<%#DataBinder.Eval(Container.Data Item, "CustTID")%>'></asp:LinkButton>
</asp:TableCell>
<asp:TableCell Visible="false" Width="100%">
<asp:Label ID="lblimg" ForeColor="White" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "CustTTabImg")%>' ></asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:DataList>
<asp:PlaceHolder ID="phAddress" runat="server" Visible="true">
</asp:PlaceHolder>
</div>
[/HTML]
Mar 10 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Can you show the client-side version of this? Are there any errors?
Mar 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.