Results 1 to 33 of 33

Thread: [RESOLVED] please help

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Resolved [RESOLVED] please help

    Code:
    <script language="javascript" type="text/javascript">
        
        function open()
        {
        window.open("Default2.aspx","BlueWindow","width=400,height=400");
        }
        
        </script>
    
    <asp:Button ID="Button3" runat="server" Text="Open" OnClientClick="open()" />
    this did not opened the window......

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: please help

    Hey,

    Are you getting any JavaScript errors on the page? If so, what are they?

    I suspect the problem here is that it can't find Default2.aspx.

    Gary

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    how to catch the JavaScript errors throwing by the page?

    this is what i have in the Default2.aspx:
    Code:
    <&#37;@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body style="background:blue">
        <form id="form1" runat="server">
        <div>
        
        </div>
        </form>
    </body>
    </html>

  4. #4
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    hey,
    could you please change your
    Code:
    window.open("Default2.aspx","BlueWindow","width=400,height=400");
    to
    Code:
    window.open('Default2.aspx','BlueWindow','width=400,height=400');
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  5. #5
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    904

    Re: please help

    sorry the single quotes wont work............

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    Quote Originally Posted by HowTo View Post
    sorry the single quotes wont work............

  7. #7
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    it is working with me right now and i test it,
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  8. #8
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    add this also,
    i test it for IE8 and Firefox and it working with single quotes
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    this is what i have:
    Code:
     function open()
        {
        window.open('Default2.aspx','BlueWindow','width=400,height=400');
        }
    but it did not work

  10. #10
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    ok, let's do it in another way

    in your page load add these
    Code:
    Button3.Attributes.Add( "onclick", "open();return false;" );
    and try it
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  11. #11
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    hey, if this didn't work with you, so please make sure that you allow scripting on your browser
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    Quote Originally Posted by avrail View Post
    hey, if this didn't work with you, so please make sure that you allow scripting on your browser
    and how to do this?

  13. #13
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  14. #14
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  15. #15
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 2010
    Location
    Philippines
    Posts
    166

    Re: please help

    I don't know if this one is the same with you guys, but here... Going back to your code...

    Code:
    <script language="javascript" type="text/javascript">
        function open()
            {
            window.open("Default2.aspx","BlueWindow","width=400,height=400");
            }
    </script>
    
    <asp:Button ID="Button3" runat="server" Text="Open" OnClientClick="open()" />
    From my experience, that runat="server" and JavaScript don't mix. If you want to execute this one in JavaScript use this one instead

    Code:
    <input type="button" id="Button3" value="Open" onclick="open()" />
    If you want to keep the runat="server" part, you have to type your code in the aspx.vb file, like so:

    Code:
    Response.Redirect("Default2.aspx")
    If a post was helpful to you in any way, rate it. If your problem/question has already been solved/answered, remember to mark your thread as resolved.

    Useful Tools: C# to VB Converter
    Tutorial Sites: W3Schools|ASP.Net|ASP.Net QuickStart|LearnVisualStudio.Net

    So many things to learn, so little time... >_<

    Under Construction...

  16. #16
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    hey Tommy,
    what's going with You ?
    still facing problems
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  17. #17
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: please help

    Claude,

    That isn't quite true.

    The runat=server attribute is definitely required, as this indicates that the button control is an ASP.Net Control, and will be treated as such when the page is parsed by the ASP.Net engine. Without it, the button will not function.

    What the OP could do though is not use an ASP.Net Control, but rather an HTML control, such as <input> with a type of Button, and then use the onclick event do to the window.open.

    Tommy.Net, it would appear that the function name "open" is reserved, that is why it is not working. Change you function name to something other than open, and it should work.

    Gary

  18. #18
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 2010
    Location
    Philippines
    Posts
    166

    Re: please help

    The runat=server attribute is definitely required, as this indicates that the button control is an ASP.Net Control, and will be treated as such when the page is parsed by the ASP.Net engine. Without it, the button will not function.
    Yep, I know. That's why I suggested he could try changing the <asp:Button> control with the <input> tag. I have the exact problem with JavaScript recently. I keep on reviewing and re-typing my script but I still found no errors, the function won't execute. Changing the ASP.NET control to a HTML tag solves it since I don't need any server side scripts.
    If a post was helpful to you in any way, rate it. If your problem/question has already been solved/answered, remember to mark your thread as resolved.

    Useful Tools: C# to VB Converter
    Tutorial Sites: W3Schools|ASP.Net|ASP.Net QuickStart|LearnVisualStudio.Net

    So many things to learn, so little time... >_<

    Under Construction...

  19. #19
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    Quote Originally Posted by Claude2005 View Post
    Yep, I know. That's why I suggested he could try changing the <asp:Button> control with the <input> tag. I have the exact problem with JavaScript recently. I keep on reviewing and re-typing my script but I still found no errors, the function won't execute. Changing the ASP.NET control to a HTML tag solves it since I don't need any server side scripts.
    hey Claude,
    tommy codes should be work fine, the most important thing is that, we need to know why this happens.
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    nope...........the problem is not yet solved

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    when i changed the function name from open to open1 then a postback takes place but did not opened the new window............

    earlier when i tried with the function name open then no postback takes place

    suggessions?

  22. #22
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: please help

    This is the code that I used:

    Code:
    <head runat="server">
        <title></title>
        <script language="javascript" type="text/javascript">
        function opengary() {
            alert("hi");
                window.open("WebForm1.aspx", "BlueWindow", "width=400,height=400");
                return false;
            }
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return opengary()" />
        </div>
        </form>
    </body>
    Gary

  23. #23
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    hey tommy,
    if the gep code's above didn't solve your problem,
    please could you send us the error message that appears,
    or if you can debug your JavaScript, this will help more,
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    Quote Originally Posted by avrail View Post
    please could you send us the error message that appears
    no error message appears

    Quote Originally Posted by avrail View Post
    if you can debug your JavaScript, this will help more,
    how to do this?

  25. #25
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: please help

    Hey,

    Did you take the code exactly as I posted above?

    If so, I don't see any reason why this wouldn't work?!?

    Can you post ALL the code that you are currently using?

    Which browser are you using? The way to see JavaScript errors varies based on which browser you are using.

    Gary

  26. #26
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    Quote Originally Posted by Tommy.net View Post
    no error message appears



    how to do this?
    hey,
    about how to do it, let us know first which browser you are using,
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: please help

    ok now i get it working.......geps code is working good for me.......

    what was the fault in the code that i posted in my 1st post of this thread?Was it the function name open?

    one more thing i would like to ask:i am using the IE7 browser......so how to check what error does my javascript code is throwing?

  28. #28
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    good to hear this at last,
    actually I used IE8 and from tools there is an item named Developer tools,
    this tool you can use it for debugging your JavaScript codes, I don't really know is it exist for IE7 or not,
    but i believe that you can check for that on google
    don't forget to mark the thread as resolved
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  29. #29
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    904

    Re: please help

    Quote Originally Posted by Tommy.net View Post
    what was the fault in the code that i posted in my 1st post of this thread?Was it the function name open?
    ????

  30. #30
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    904

    Re: please help

    Quote Originally Posted by avrail View Post
    this tool you can use it for debugging your JavaScript codes
    i cant find the tool in my IE8.......can you please help me

  31. #31
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] please help

    Yes, it was the function name that was causing the problem.

    In IE8, go to Tools | Developer Tools.

    Gary

  32. #32
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    Quote Originally Posted by HowTo View Post
    i cant find the tool in my IE8.......can you please help me
    hey,
    I believed that gep had answer the Question.
    i think it is clear now, if not let us know
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  33. #33
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: please help

    Quote Originally Posted by Tommy.net View Post
    no error message appears
    hey,
    about this you will see the error message if there is any for the website JavaScript errors, at the bottom of the browser on your left.

    double click on it, you will see the error message
    Last edited by avrail; Jun 18th, 2010 at 12:12 PM.
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width