Monday, December 17, 2007

pop up window via javascript ( window.open method)

//function to open a new window
function open_window()
{
var win = window.open('new_win.html','win',
'left=4,top=4,width=4,height=6,toolbar=1,resizable=0,scrollbars=1,
menubar=1,status=1,directories=1,location=1');
}

properties
toolbar=1 or 0 Want to display the toolbar in the new window or not.
location=1 or 0 Want to display the address line in the new window or not.
directories=1 or 0 Want to display the Netscape directory buttons or not.
status=1 or 0 Want to display the browser status bar or not.
menubar=1 or 0 Want to display the browser menu bar or not.
scrollbars=1 or 0 Want the new window should have scrollbars or not.
resizable=1 or 0 Want the new window is resizable or not.

width=pixels Specify the width of the new window.

height=pixels Specify the height of the new window.

top=pixels Specify the Y coordinate of the top left corner of the new window.)
left=pixels Specify the X coordinate of the top left corner of the new window

Friday, October 12, 2007

Calling a server side function from javascript.

Javascript code

function bind()
{

var btn = document.getElementById("Button1");
btn.click();

}


Html code
<table>
<tr style="display:none" ><td><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /></td></tr>
</table>


Code behind code

protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("
Button1 clicked");
}