window.open()

Last post 01-19-2005, 7:47 AM by paulf. 2 replies.
Sort Posts: Previous Next
  •  01-18-2005, 11:52 AM 3547

    window.open()

    Is it possible to add an onlick event to a link so as to execute javascript:window.open using the editor.

    I have this javascript in the header of the aspx page

    var win = null;
    function NewWindow(mypage,myname,w,h,scroll,resizable){
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=' + resizable win = window.open(mypage,myname,settings)
    }

    Which nicely opens a window in centre of screen.

    I wish to be able to have a link like so

    <A onclick="NewWindow(this.href,'name','746','532','no','no');return false" href="http://www.cutesoft.net">cutesoft.net</A>

    How would I go about accomplishing this?

    Thanks

  •  01-19-2005, 12:36 AM 3558 in reply to 3547

    Re: window.open()

    paulf,

    Have you checked the following example?

    http://cutesoft.net/example/customization.aspx

     
      CuteEditor.ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];
      if(tc!=null)
      {    
           System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();
           Image1.ToolTip    = "Insert today's date";
           Image1.ImageUrl    = "tools.gif";
           Image1.CssClass    = "CuteEditorButton";
           SetMouseEvents(Image1);
           Image1.Attributes["onclick"]= <put your JavaScript function>;
           tc.Control.Controls.Add(Image1);
       }
     
     
    Hope it helps.
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  01-19-2005, 7:47 AM 3574 in reply to 3558

    Re: window.open()

    Thanks but I'm not sure that's what I need.

    What I want is to be able to add somthing like

    <A onclick="NewWindow(this.href,'name','746','532','no','no');return false" href="default.html">Link</A>

    Into the HTML. Even if I try to put the above in HTML mode and switch to normal then back to HTML view it gives me something like <a href="http://localhost/project/default.html">Link</a>

    So even if I could get a button to add this (which I cannot at the moment), it looks like I will be losing the onclick event.

    Is there anyway at all that users can add links that utilise window.open() rather than a target = "_blank" link?

    Thanks

View as RSS news feed in XML