Feeds:
Posts
Comments

Test

Test

In aspx

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head1″ runat=”server”>

<title>Untitled Page</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<input id=”File1″ style=”WIDTH: 468px; HEIGHT: 22px” type=”file” size=”58″

runat=”server” accessKey=” “/>

<br />

<asp:Button ID=”btnSubmit” runat=”server” Text=”Submit” OnClick=”btnSubmit_Click”

/>

</div>

</form>

</body>

</html>

 
 
 
In Aspx.cs

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

public partial class Default1 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void btnSubmit_Click(object sender, EventArgs e)

{

Response.Write(Path.GetFullPath(File1.PostedFile.FileName));

}

}

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title>Untitled Page</title>

    <script type="text/javascript">    

        function ReceiveServerData(arg, context)

        {

           //alert(arg);

        }

        function getValues()

        {

            var name='john';

            CallTheServer(name, '');

        }

    </script>

</head>

<body >

    <form id="form1" runat="server">

        <div>

            <input id="btnSubmit" type="button" value="Submit" onclick="getValues();" />        

        </div>

    </form>

</body>

</html>

In C# Code Behind

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class Default7 : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!Page.IsPostBack)

        {

            string cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context");

            string callbackScript = "function CallTheServer(arg, context) {" + cbReference + "; }";

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallTheServer", callbackScript, true);

        }

    }

    public string GetCallbackResult()

    {

        return "";

    }

    public void RaiseCallbackEvent(string eventArgument)

    {

        //In this POint U will get Value john in eventArgument

    }

}

Collected from http://www.java2s.com/Code/JavaScript/Development 

<html>

<head>

</head>

<body>

<script type=”text/javascript” >

function weekNo() {

var totalDays = 0;

now = new Date();

years=now.getYear();

var days = new Array(12);

days[0] = 31;

days[2] = 31;

days[3] = 30;

days[4] = 31;

days[5] = 30;

days[6] = 31;

days[7] = 31;

days[8] = 30;

days[9] = 31;

days[10] = 30;

days[11] = 31;

// is it a leap year

//////////////////////////////////////////////////

// has some year 2000 problem

// should check the year by dividing 4000

//

//////////////////////////////////////////////////

if (Math.round(now.getYear()/4) == now.getYear()/4) {

days[1] = 29

}else{

days[1] = 28

}

// If this is January

if (now.getMonth() == 0) {

totalDays = totalDays + now.getDate();

}else{

var curMonth = now.getMonth();

for (var count = 1; count <= curMonth; count++) {

totalDays = totalDays + days[count - 1];

}

totalDays = totalDays + now.getDate();

}

var agt=navigator.userAgent.toLowerCase();

if ((agt.indexOf(“msie”) != -1) && (agt.indexOf(“opera”) == -1)) {

var firstday=new Date(“01/01/”+String(now.getYear())).getDay();

}else {

var firstday=new Date(“01/01/”+String(1900+now.getYear())).getDay();

}

var diff=7-firstday+1;

var week = Math.round((totalDays+diff-firstday)/7); return week;

}

document.write(“Week “+weekNo()+” of “+years)

</script>

</body>

</html>

  

<html>

<body>

<script type=”text/javascript”>

var d=new Date()

var weekday=new Array(“Sunday”,“Monday”,“Tuesday”,“Wednesday”,“Thursday”,

“Friday”,“Saturday”)

document.write(“Today is “ + weekday[d.getDay()])

document.write(“Today Date is “ + d.getDate())

</script>

</body>

</html>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head1″ runat=”server”>

<title>Untitled Page</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<asp:Label ID=”lblTemp” runat=”server” Text=”98″></asp:Label>

<br />

<asp:Button ID=”btnCtoF” runat=”server” Text=”Convert To Far” OnClientClick=”return CToF();” />

<asp:Button ID=”btnFtoC” runat=”server” Text=”Convert To Cel” OnClientClick=”return FtoC();” />

</div>

</form>

</body>

<script type=”text/javascript”>

var lblTemp=document.getElementById(‘<%=lblTemp.ClientID %>’);

function CToF()

{

lblTemp.innerHTML=Math.round((((212-32)/100)*lblTemp.innerHTML+32)*100)/100;

return false;

}

function FtoC()

{

lblTemp.innerHTML=Math.round(((100/(212-32))*(lblTemp.innerHTML-32))*100)/100;

return false;

}

</script>

</html>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head1″ runat=”server”>

<title>Untitled Page</title>

<script type=”text/javascript” >

function Showhgt()

{

var tblId=document.getElementById(‘tblId’);

alert(‘Width :’ +tblId.offsetWidth);

alert(‘Height :’ +tblId.offsetHeight);

}

</script>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<table width=”100%” id=”tblId” cellpadding=”0″ cellspacing=”0″

border=”1″>

<tr >

<td style=”width: 50;”>

Col1</td>

<td width=”30″>

Col2</td>

<td width=”50″>

Col3</td>

<td width=”100″>

Col4

</td>

<td width=”100″>

Col5

</td>

<td width=”50″>

Col6

</td>

<td>

Col7</td>

</tr>

</table>

<input id=”btnSubmit” type=”button” value=”Show Height” onclick=”Showhgt();” />

</div>

</form>

</body>

</html>

 

<html xmlns=”http://www.w3.org/1999/xhtml”>

<script type=”text/javascript”>

function clik()

{

var element=document.getElementById(‘element’);

if (document.all)

{

var range= element.createTextRange();

range.collapse(false);

range.select();

}

else {

element.focus();

var v= element.value;

element.value= ;

element.value= v;

}

}

</script>

<body>

<form id=”form1″ runat=”server”>

<input id=”element” type=”text” />

<input id=”Button1″ type=”button” value=”Focus” onclick=”clik();” />

</form>

</body>

</html>


In Table

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head1″ runat=”server”>

<title>Untitled Page</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<table style =”width:100%; “>

<tr>

<td style=”text-align:left ; “ >

<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>

</td>

</tr>

<tr>

<td style=”text-align:left ; “>

<asp:TextBox ID=”TextBox2″ runat=”server”></asp:TextBox>

</td>

</tr>

<tr>

<td style=”text-align:right ; “>

<asp:DropDownList ID=”DropDownList1″ runat=”server”>

</asp:DropDownList>

</td>

</tr>

<tr>

<td style=”text-align:right ; “>

<asp:DropDownList ID=”DropDownList2″ runat=”server”>

</asp:DropDownList>

</td>

</tr>

</table>

</form>

</body>

</html>
 

In Div

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head2″ runat=”server”>

<title>Untitled Page</title>

</head>

<body>

<form id=”form2″ runat=”server”>

<div style=”width: 100%; float: left; margin: 0px; padding: 0px;”>

<div style=”width: 100%; float: left; margin: 0px; padding: 0px; text-align: left;”>

<asp:TextBox ID=”TextBox3″ runat=”server”></asp:TextBox>

</div>

<div style=”width: 100%; float: left; margin: 0px; padding: 0px; text-align: left;”>

<asp:TextBox ID=”TextBox4″ runat=”server”></asp:TextBox>

</div>

<div style=”width: 100%; float: left; margin: 0px; padding: 0px; text-align: right;”>

<asp:DropDownList ID=”DropDownList3″ runat=”server”>

</asp:DropDownList>

</div>

<div style=”width: 100%; float: left; margin: 0px; padding: 0px; text-align: right;”>

<asp:DropDownList ID=”DropDownList4″ runat=”server”>

</asp:DropDownList>

</div>

</div>

</form>

</body>

</html>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head id=”Head1″ runat=”server”>

<title>Untitled Page</title>

<script type=”text/javascript”>

function ShowHideDivNew(item,pos)

{

if (item.style.display == ‘block’)

{

item.style.display = ‘none’;

}

else

{

switch(pos)

{

case 1:

setStatus(‘block’,‘none’,‘none’,‘none’,‘none’);

break;

case 2:

setStatus(‘none’,‘block’,‘none’,‘none’,‘none’);

break;

case 3:

setStatus(‘none’,‘none’,‘block’,‘none’,‘none’);

break;

case 4:

setStatus(‘none’,‘none’,‘none’,‘block’,‘none’);

break;

case 5:

setStatus(‘none’,‘none’,‘none’,‘none’,‘block’);

break;

}

return false;

}

}

function setStatus(stat1,stat2,stat3,stat4,stat5)

{

var div1=document.getElementById(‘div1′);

var div2=document.getElementById(‘div2′);

var div3=document.getElementById(‘div3′);

var div4=document.getElementById(‘div4′);

var div5=document.getElementById(‘div5′);

div1.style.display = stat1;

div2.style.display = stat2;

div3.style.display = stat3;

div4.style.display = stat4;

div5.style.display = stat5;

}

</script>

</head>

<body>

<form id=”form1″ runat=”server”>

<div id=”div1″ style=”display: block; width: 100px; height: 10px; background-color: Red;”>

</div>

<br />

<asp:Button ID=”Button1″ runat=”server” Text=”Submit” OnClientClick=”return ShowHideDivNew(this,1)” />

<div id=”div2″ style=”display: none; width: 100px; height: 10px; background-color: RoyalBlue;”>

</div>

<br />

<asp:Button ID=”Button2″ runat=”server” Text=”Submit” OnClientClick=”return ShowHideDivNew(this,2)” />

<div id=”div3″ style=”display: none; width: 100px; height: 10px; background-color: Salmon;”>

</div>

<br />

<asp:Button ID=”Button3″ runat=”server” Text=”Submit” OnClientClick=”return ShowHideDivNew(this,3)” />

<div id=”div4″ style=”display: none; width: 100px; height: 10px; background-color: Plum;”>

</div>

<br />

<asp:Button ID=”Button4″ runat=”server” Text=”Submit” OnClientClick=”return ShowHideDivNew(this,4)” />

<div id=”div5″ style=”display: none; width: 100px; height: 10px; background-color: Purple;”>

</div>

<br />

<asp:Button ID=”Button5″ runat=”server” Text=”Submit” OnClientClick=”return ShowHideDivNew(this,5)” />

</form>

</body>

</html>

Older Posts »