Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.

XML
<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..
Posted
Comments
Sergey Alexandrovich Kryukov 17-Apr-12 1:06am    
What is the problem? Do you want to open or not?
--SA
DINESH K MAURYA 17-Apr-12 1:18am    
it open but twice click
i want to open single click event
Sergey Alexandrovich Kryukov 17-Apr-12 1:07am    
And there is no such think as "Java script". Java is not a scripting language, and it has nothing to do with JavaScript.
--SA
ZurdoDev 17-Apr-12 10:27am    
English is not your first language either. You need to be more forgiving. I think everyone knows that Java script is JavaScript.
Sergey Alexandrovich Kryukov 20-Apr-12 16:17pm    
I am not more forgiving by two important reasons: 1) I do not blame anyone, so no one really needs forgiving; things should be made clear enough to provide help, that's all I care about; 2) yes, English is not my native language; and I still have some problems with English myself, but -- it only makes more important to type things accurately; you see, correct spelling does not need much more effort for a non-native speaker, but recognition of poorly spelled text is harder for a non-native speaker. All for all, correct spelling is important and can reasonably be demanded.

As to "Java script", the nature of problem is different. I know for sure that some people think that Java is related to JavaScript.
--SA

Put
JavaScript
alert("test");
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?
JavaScript
return false;
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.
 
Share this answer
 
C#
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;
        }
 
Share this answer
 

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



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