如何通过Java脚本打开新窗口 [英] how to open new window by java script

查看:58
本文介绍了如何通过Java脚本打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码打开新窗口.它工作正常,但是当我双击然后将其打开.
如何解决问题.

i am using following code for open new window..its working fine but when i double click then it open.
how to solve the problem.

<script type="text/javascript">
             function ShowImage(userID, ImagePath) {
                 var ImageID = document.getElementById("<%=imgProfilePhoto.ClientID %>").ImageUrl;

                 if (ImageID == "") {
                     alert = "You have not Uploaded any Images"

                 }
                 else {

                     var value = userID + ';' + ImageID

                     window.open('SlideImage.aspx?ImageLarge=' + value, '_blank', 'height=750,width=900,top=0,left=0, scrollbars=yes, resizable=yes titlebar = no, directories = no, ');


                 }
                 return false
             }

         </script>


在此先感谢..


thanks in advance..

推荐答案

放入
alert("test");

在if中阻止并测试功能.如果出现带有"test"的弹出窗口,则意味着在第一次单击时,id为空.我不确定这可能是什么原因.页面可能尚未完全呈现,但是可能还有许多其他原因.
你为什么要这样做?

in the if block and test the function. If you get a popup with "test" that means that on the first click the id is empty. I''m not sure what the reason of this could be. Maybe the page hasn''t rendered yet completely, but there might be many other reasons possible.

Why are you doing this?

return false;

似乎不需要我.

您还可以将事物包装在try/catch的catch中,然后再次发出警报以查看是否在某处引发了异常.

哪个控件正在调用此函数?它是如何定义的?

希望您对如何找到问题有一些想法.

Doesn''t seem necessary to me.

You could also wrap the thing in a try/catch in the catch you put an alert again to see if an exception is thrown somewhere.

What control is calling this function? How is it defined?

hope you have some ideas on how to find your problem.


function FunctionRedirect {
            var ReturnedValue = window.showModalDialog('RegConfirmation.aspx', window, 'dialogWidth:520px; dialogHeight:132px; status:no; center:yes');

            if (ReturnedValue == "Cancel")
                return false;
            else if (ReturnedValue == "Ok")
                return true;
            else
                return false;
        }


这篇关于如何通过Java脚本打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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