How can i resize the dialog window?
You can size a window with JavaScript using ‘window.resizeTo(valueX,valueY)’. <script> functionResizeWindow() { window.resizeTo(800,800); } </script> Note also that the parameters of resizeTo() have different meaning in different browsers: in Internet Explorer the parameters specify the outer size of the window, while in Netscape Navigator they refer to the inner size (which does not include the window borders, toolbar, status bar, title bar, and the address line). The ‘window.resizeBy()’ method is slightly different than it’s ‘resizeTo()’ which changes window’s dimensions to a certain number of pixels from it’s current size.
How can you get the X Co-ordinates Y Co-ordinates values during the Mouse Movement?
The X and y co-ordinates during the mouse movement can be obtained by the following codings. <html> <body> <form name=’Show’> <b>X Co-Ordinate Value:</b><input type=”text” name=”X” value=”0″ size=”4″> <br> <b>Y Co-Ordinate Value:</b><input type=”text” name=”Y” value=”0″ size=”4″> <br> </form> <script language=’Javascript’> <!– // Detect if the browser is IE or not. // If the browser is not IE, we assume that the browser is NS. var IE = document.all?true:false // If NetScape then set up for mouse capture if (!IE) document.captureEvents(Event.MOUSEMOVE) // Set-up to use getMouseXY function onMouseMove document.onmousemove = getMouseXY; // Temporary variables to hold mouse x-y pos.s var tempX = 0 var tempY = 0 // Main function to retrieve mouse x-y pos.s function getMouseXY(e) { if (IE) { // grab the x-y pos.s if browser is IE tempX = event.clientX + document.body.scrollLeft; tempY = event.clientY + document.body.scrollTop; } else { // grab the x-y pos.s if browser is NS tempX = e.pageX; tempY = e.pageY; } // catch possible negative values in NS4 if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} // show the position values in the form named Show // in the text fields named MouseX and MouseY document.Show.X.value = tempX; document.Show.Y.value = tempY; return true; } //–> </script> </body> </html>
How can you make a piece of text get moving along the mouse Movement?
We can make text to move along the mouse using javascript as given below, <html> <head> <style> .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:10pt; font-family:Verdana; font-weight:bold; color:black; } </style> <script> var x,y var step=20 var flag=0 var text=’Syncfusion .NET Essentials ‘ text=text.split(”) var xpos=new Array() for (i=0;i<=text.length-1;i++) { xpos[i]=-50 } var ypos=new Array() for (i=0;i<=text.length-1;i++) { ypos[i]=-50 } function handlerMM(e) { x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function MoveText() { if (flag==1 && document.all) { for (i=text.length-1; i>=1; i–) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<text.length-1; i++)=”” {=”” var=”” spanvalue=”eval(‘span’+(i)+’.style’)” spanvalue.posleft=”xpos[i]” spanvalue.postop=”ypos[i]” }=”” else=”” if=”” (flag=”=1″ &&=”” document.layers)=”” for=”” (i=”text.length-1;” i=””>=1; i–) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<text.length-1; i++)=”” {=”” var=”” spanvalue=”eval(‘document.span’+i)” spanvalue.left=”xpos[i]” spanvalue.top=”ypos[i]” }=”” timer=”setTimeout(‘MoveText()’,30)” <=”” script>=”” head>=”” <body=”” onload=”MoveText()” style=”width:100%;overflow-x:hidden;overflow-y:scroll” >=”” <script>=”” for=”” (i=”0;i<=text.length-1;i++)” document.write(‘<span=”” id=”’span’+i+’’” class=”’spanstyle’”>’) document.write(text[i]) document.write(”) } if (document.layers) { document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = handlerMM; </script> </body> </html> </text.length-1;></text.length-1;>
How do I programatically change the color of a control
Use the properties BackColor and ForeColor. button1.BackColor = Color.White; button1.ForeColor = Color.Blue;
How can you create a check box dynamically in the server control?
usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Text; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; namespace WebCustomControl1 { [DefaultProperty(‘Text’)] [ToolboxData(‘<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>’)] public class WebCustomControl1 : WebControl { [Bindable(true)] [Category(‘Appearance’)] [DefaultValue(”)] [Localizable(true)] public string Text { get { String s = (String)ViewState[‘Text’]; return ((s == null) ? String.Empty : s); } set { ViewState[‘Text’] = value; } } protected override void CreateChildControls() { CheckBox blah = new CheckBox(); blah.Text = ‘CheckText’; blah.ID = ‘CheckValue’; this.Controls.Add(blah); } protected override void RenderContents(HtmlTextWriter writer) { this.EnsureChildControls(); this.RenderChildren(writer); } } }