Click here to Skip to main content
14,694,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi, I am using one javascript function to pop up DIV content.

i have to show image and few lablel value.
here, i give full coding.

this javascript function works(all values and image showing) in chrome and IE browser. but it is not working in firefox.
i mean while the div is poped up, few values(image only showing) popedup but i assingend label value from javascript popup function. those value is not showing in firefox.

where i made mistake, how to solve this problem.

Javascript funtion:

<script type="text/javascript">

function show_popup(pric,image) {

var popup = document.getElementById('<%=popup.ClientID %>');
popup.style.visibility = 'visible';
document.getElementById('Div1').style.display = 'block';
document.getElementById('<%=lbln.ClientID %>').innerText = pric;

document.getElementById('<%=img.ClientID %>').src = imgurl;

return false;
}
function hidePopup() {
var popup = document.getElementById('<%=popup.ClientID %>');
popup.style.visibility = 'hidden';
document.getElementById('Div1').style.display = 'none';
return false;
}
</script>


aspx:

<asp:LinkButton ID="lnview" Visible="false" runat="server" Text="See Price in Cart" OnClientClick="return showPopup('Div1');"></asp:LinkButton>

<div id="popup" align="center" class="popup" runat="server">
<table width="100%" style="lef:50%;">
<tr><td style="font-family:Verdana; font-size:16px; color:#565454; ">Your Price :</td>
<td><asp:Label ID="lbln" runat="server" ForeColor="#ff0000" Font-Names="Verdana" Font-Size="15px" Font-Bold="true"></asp:Label></td></tr>
<tr align="center"><td><asp:Image ID="img" runat="server" Width="130px" Height="150"/></td></tr>

</div>
<div id="Div1" class="overlay" >
</div>

here, pric, image i am sending value from code behind language: so, when click "see price in cart" (which is linkbutton) these values are passing to that javascript funtion.

aspx.cs (code behind language)
lnview.OnClientClick = "return show_popup('" + lblpricedol.ToString().Trim() + "','" + imgitem.ImageUrl.Trim() + "'); return false;";

css code:
<style type="text/css">
.popup {
width:439px;
height:365px;
position:fixed;
top:50%;
left:36%;
right:10%;
bottom:50%;
margin:-50px 0 0 -100px; /* [-(height/2)px 0 0 -(width/2)px] */
z-index:2222;
background-color:#FFFFFF;

color:White;
visibility:hidden;
}

.overlay{
display:none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color:black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
</style>

alert(imgurl); and alert(price);//just tested to check value passing or not. values are passing only. but ,

while testing with alert in chrome it displays message like follows: same thing with IE ( here everthing works good).

The page at localhost:34445 says:

pricevalue

prevent this page from creating additonal dialogs.

while testing with alert in firefox, it displays message like follows with the box:

pricevalue //here it shows in alert only price value. not displaying page at localhost and other stuff which shows in chrome and IE.


i do not understand any css was not supported or javascript was not supported on firefox alone..remaining browser works perfectly. please help me out.
Posted
Updated 6-Dec-13 1:51am
v4
Comments
Sampath Lokuge 6-Dec-13 5:31am
   
Check whether is there any errors on Firebug ?

1 solution

hi, i fixed myself that why few values are showing in chrome and IE, but not showing in firefox.

here i give solution.

if you look at above javasctipt function, i used innerText. right?. so the innerText works only on Chrome and IE. it is not working in firefox. so, i used innerHTML instead of innerText. now it works in all browser.



Thank you!.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900