linkbutton中的弹出窗口适用于chrome和IE。但是,不在firefox中工作。 [英] Popup in linkbutton works on chrome and IE. but, not working in firefox.

查看:58
本文介绍了linkbutton中的弹出窗口适用于chrome和IE。但是,不在firefox中工作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个javascript函数来弹出DIV内容。



i必须显示图像和少量标签值。

在这里,我给出完整的编码。



这个javascript函数在chrome和IE浏览器中工作(所有值和图像显示)。但它不适用于Firefox。

我的意思是当div加速时,几个值(图像只显示)popedup但我从javascript弹出功能中识别标签值。这些价值没有在firefox中显示。



我犯了错误,如何解决这个问题。



Javascript功能:



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:





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>



这里,pric,image我从语言后面的代码发送价值:所以,当点击查看购物车中的价格(这是链接按钮) )这些值传递给javascript函数。



aspx.cs(语言代码)


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);和警报(价格); //只是测试以检查值传递与否。价值只是通过。但是,



在Chrome中使用alert进行测试时会显示如下消息:与IE相同(这里的情况很好)。



localhost:34445的页面说:



pricevalue



阻止这个创建附加对话框的页面。



在firefox中使用alert进行测试时,它会显示如下消息:



pricevalue //此处仅显示警报价格值。没有在localhost显示页面以及Chrome和IE中显示的其他内容。





i不明白任何css不支持或javascript是单独的firefox不支持..保持浏览器完美运行。请帮帮我。


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.

推荐答案

我自己解决了为什么很少有值在chrome和IE中显示,但没有在firefox中显示。



这里我给出了解决方案。



如果你看看上面的javasctipt函数,我使用了innerText。对?。所以innerText仅适用于Chrome和IE。它不适用于Firefox。所以,我使用innerHTML而不是innerText。现在它适用于所有浏览器。







谢谢!。
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!.

这篇关于linkbutton中的弹出窗口适用于chrome和IE。但是,不在firefox中工作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆