Thursday, August 28, 2008

upload files using javscript

A goood link

http://www.siccolo.com/Articles/CodeProject/UploadControl_Javascript/upload_control.html

Enjoy

Friday, August 22, 2008

For Stripping HTML Tags from Text

http://www.javascriptkit.com/script/script2/removehtml.shtml

Thursday, August 21, 2008

RichTextBox HtmlArea

Want a Rich TextBox in a normal <textarea> control
visit this link

http://www.codeproject.com/KB/scripting/htmlarea.aspx

for Rendering the HTML back into the formatted manner
<label id="emailsumPrev" runat="server" ><%= HttpUtility.HtmlDecode(getRequestFormValue()) %></label>


THe HtmlArea value will be viewed from Server side through

Page.Previous.Request.Form["htmlarea1"] and only if the EnableViewState of the htmlarea is set to True

public string getRequestFormValue()
{
return Page.Previous.Request.Form["htmlarea1"];
}

My very own dateValidator

Hi Folks This is a date validator . Try it It accepts Dates in the format
"3 June 2008" . The parameters are the datestring mydate and the clientid of the date control in the form

function validateMyDate(mydate, dateid)
{
var my_date= new Date(mydate);
var pos1=mydate.indexOf('/');
var pos2=mydate.indexOf('-');

var nn = my_date;

if(nn=="NaN" || pos1 > 0 || pos2 > 0)
{return false;}
else
{
var day = my_date.getDate();
var month = my_date.getMonth();
var monthname ;

switch(month)
{
case 0:monthname="January";break;
case 1:monthname="February";break;
case 2:monthname="March";break;
case 3:monthname="April";break;
case 4:monthname="May";break;
case 5:monthname="June";break;
case 6:monthname="July";break;
case 7:monthname="August";break;
case 8:monthname="September";break;
case 9:monthname="October";break;
case 10:monthname="November";break;
default:monthname="December";break;
}

var year = my_date.getFullYear();
document.getElementById(dateid).value = day + " " + monthname + " " + year;

return true;
}

}

Wednesday, August 20, 2008

Div on top of another Div

Hi,

The below code can be useful to place one div dynamically above another div without occupying a space .

//*********************************************************************************

<form id="form1" runat="server">
<script language ="javascript" type="text/javascript" >

function showMe(j)
{
document.getElementById("Panel1").style.display = 'none';
document.getElementById("Panel2").style.display = 'none';

if(j.checked)
{
if(j.id=="chek1")
{
document.getElementById("Panel1").style.display = 'block';
}

if(j.id=="chek2")
{
document.getElementById("Panel2").style.display = 'block';
}
}
}

</script>
<table style="width: 50%">
<tr >
<td>
<input type="checkbox" onclick ="showMe(this)" id="chek1" runat="server" />
Email</td>
</tr>
<tr >
<td>
<input type="checkbox" id="chek2" onclick ="showMe(this)" runat="server" />
Home Mailing</td>
</tr>
</table>

<table style="width: 464px" >
<tr>
<td>
<div style="display:none ; width: 452px; height: 100px; background-color: #ccffff;" id="Panel1" >
Message <input id="Text1" type="text" runat="server" />
<br />
<asp:TextBox TextMode ="MultiLine" ID="comment1" runat ="server" ></asp:TextBox>
</div>
<div style="display:none ; width: 452px; height: 100px; background-color: #ffccff;" id="Panel2" >
Home Mailing <input id="Text2" type="text" runat="server" />
<br />
<asp:TextBox TextMode ="MultiLine" ID="comment2" runat ="server" ></asp:TextBox>
</div>
</td></tr>
</table>
</form>
</body>

/****************************************************************************