Below code is to create WORD file and then write in it. Its simple form, and value entered in Textbox will be written in WORD file.
<?
if($_POST)
{
$fp = fopen("test.doc", 'w+');
$str = "First Name: " .$_POST['fname']."\n";
$str .= "Middle Name: " .$_POST['mname']."\n";
$str .= "Last Name: " .$_POST['lname']."\n";
fwrite($fp, $str);
fclose($fp);
}
?>
<form method="post">
First Name : <input type="text" name="fname"><br />
Middle Name : <input type="text" name="mname"><br />
Last Name : <input type="text" name="lname"><br />
<input type="submit" name="submit">
</form>
This blog is specially design to help out various queries related with ASP.NET, PHP, ASP, HTML, SQL SERVER, CSS, JavaScript...
Search me out HERE!!
Setting TEXTBOX Background Image and Color Using JavaScript & CSS
Consider below textbox:
<input type="text" id="textbox_name" />
Now you can apply BACKGROUND COLOR or BACKGROUND IMAGE using below JAVASCRIPT or CSS
// USING STYLE CSS
.textbox
{
background-color:#FFFFFF;
background:url(images/test.jpg);
}
// USING JAVASCRIPT
function set_background
{
document.getElementById('textbox_name').style.backgroundColor = '#FFFFFF'; document.getElementById('textbox_name').style.backgroundImage="url(images/test.jpg)";
}
<input type="text" id="textbox_name" />
Now you can apply BACKGROUND COLOR or BACKGROUND IMAGE using below JAVASCRIPT or CSS
// USING STYLE CSS
.textbox
{
background-color:#FFFFFF;
background:url(images/test.jpg);
}
// USING JAVASCRIPT
function set_background
{
document.getElementById('textbox_name').style.backgroundColor = '#FFFFFF'; document.getElementById('textbox_name').style.backgroundImage="url(images/test.jpg)";
}
TO FIND BROWSER USING JAVASCRIPT
Using below JavaScript you can get information about browser.
<script language="JavaScript" type="text/javascript">
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; // For IE
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // For Firefox
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; // For Opera
alert(isIE);
alert(isWin);
alert(isOpera);
</script>
<script language="JavaScript" type="text/javascript">
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; // For IE
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // For Firefox
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; // For Opera
alert(isIE);
alert(isWin);
alert(isOpera);
</script>
Calendar using Javascript
DEMO:
Date: | (Click in Textbox) |
Click on below link to Download .js file
Click Here
Code for HTML Page
<script language="javascript" type="application/javascript" src="scw.js"></script>
Date:<input type="text" name="test" onselect='scwShow(this,event);' onclick='scwShow(this,event);' readonly="readonly" />
To apply COMMON CSS to all Textbox, Radio Button, Checkbox
Below CSS can be used to apply to all TEXTBOX, RADIO BUTTON or CHECK BOX without giving class.
CODE to be implemented in style.css file:
input[type=text]
{
//Here will be property as per requirement.
}
input[type=radio]
{
//Here will be property as per requirement.
}
input[type=checkbox]
{
//Here will be property as per requirement.
}
Same way you can apply CSS to any input type.
CODE to be implemented in style.css file:
input[type=text]
{
//Here will be property as per requirement.
}
input[type=radio]
{
//Here will be property as per requirement.
}
input[type=checkbox]
{
//Here will be property as per requirement.
}
Same way you can apply CSS to any input type.
How to disable HTML attribute using JAVASCRIPT
Below JavaScript can be used to disable HTML Attributes during run time. (Eg: TextBox, Select Box, Check Box, Radio Button, Etc)
<script>
window.onload= function()
{
DisableEnableForm(document.frmwitness,true);
}
function DisableEnableForm(xForm,xHow){
objElems = xForm.elements;
for(i=0;i
{
var ck = objElems[i].type;
if(ck=="select-one" || ck=="text")
{
objElems[i].disabled = xHow;
}
}
}
</script>
Note: You can call above function as per requirement.
<script>
window.onload= function()
{
DisableEnableForm(document.frmwitness,true);
}
function DisableEnableForm(xForm,xHow){
objElems = xForm.elements;
for(i=0;i
{
var ck = objElems[i].type;
if(ck=="select-one" || ck=="text")
{
objElems[i].disabled = xHow;
}
}
}
</script>
Note: You can call above function as per requirement.
Subscribe to:
Posts (Atom)