Thursday, March 26, 2009

Coding for changing Image display while Hover using Jquery

$(function() {
$('#div_menu a').animate({"opacity": .7 });
$('#div_menu a').hover(function() {
$(this).stop().animate({ "opacity": 3 });
},
function() {
$(this).stop().animate({ "opacity": .5 });
});
});
$(function() {
$('#div_tools img').animate({"opacity": .5 });
$('#div_tools img').hover(function() {
$(this).stop().animate({ "opacity": 1 });
},
function() {
$(this).stop().animate({ "opacity": .5 });
});
});

Coding for open a document file using javascript

Note: Works in IE only

var fso=new ActiveXObject("Word.Application");
fso.Documents.Open(open_path);
fso.Visible=true;
fso.close();

coding for reading text from file in javascript

note: It works only in IE

var fso = new ActiveXObject("Scripting.FileSystemObject");
var folderObj = fso.GetFolder("C:\\ctsi\\profile");
var fsoo=new Enumerator(folderObj.Files);
for(i=0;!fsoo.atEnd();fsoo.moveNext())
{
var filename=fsoo.item().name;
}

Tuesday, March 24, 2009

coding for Banner Animation in Jquery

imgc=1;
timer="";
$(document).ready(function(){
});
function image()
{
if($("#slideshow").html()!="Stop")
{
$("#slideshow").html("Stop");
timer=window.setInterval("slideshow()",3000);
}
else
{
$("#slideshow").html("Slideshow");
window.clearInterval(timer);
}
}



function slideshow()
{
if(imgc<11)
{
$("#img").fadeOut({complete:function(){$(this).attr("src","./images/image"+imgc+".jpg").fadeIn();}});
imgc++;
}
else
{
imgc=1;
$("#img").fadeOut({complete:function(){$(this).attr("src","./images/image"+imgc+".jpg").fadeIn();}});
}
}

Thursday, March 5, 2009

Accessing Tables from AS400 using C#.Net

For accessing IBM namespace.Add reference of IBM DB2 UDB for iSeries .Net Provider from Add Reference Window.

using IBM.Data.DB2.iSeries;

iDB2Connection connection_string = new iDB2Connection("DataSource=server_name;UserId=user_name;Password=password");
string select_query="select * from sample";
connection_string.Open();
iDB2DataAdapter Data_Adapter = new iDB2DataAdapter(select_query,connection_string);
DataSet Data_set = new DataSet();
Data_Adapter.Fill(Data_set);
GridView2.DataSource = Data_set;
GridView2.DataBind();

Writing,Reading,Deleting the Files with Javascript

function WriteToFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fso1 = new ActiveXObject("Scripting.FileSystemObject");
var filename=document.getElementById('emp_name').value;
var file_path="c:\\vijay\\"+filename+".txt";var image_path="c:\\vijay\\"+filename+"_img.txt";
if(fso.FileExists(file_path) && fso1.FileExists(image_path))
{
alert('Employee Record Found');
}
else
{
var file_details = fso.CreateTextFile(file_path, true);
var image_details = fso1.CreateTextFile(image_path, true);
var fname=document.getElementById('fname').value;
var lname=document.getElementById('lname').value;
var pic=document.getElementById('pic_file').value;
document.getElementById('img').src=pic;
image_details.writeLine(document.getElementById('pic_file').value);
file_details.WriteLine("FIRST NAME :"+fname);
file_details.WriteLine("LAST NAME :"+lname);
file_details.Close();
}}

function readfile()
{
var filename=document.getElementById('emp_show').value;
var strContents,img_cont; strContents = "";
img_cont="";
var strFileName="c:\\vijay\\"+filename+".txt";
var img_filename="c:\\vijay\\"+filename+"_img.txt";
Fileobject = new ActiveXObject("Scripting.FileSystemObject");
Fileobject1=new ActiveXObject("Scripting.FileSystemObject");
if (Fileobject.FileExists(strFileName) && Fileobject1.FileExists(img_filename))
{
strContents = Fileobject.OpenTextFile(strFileName, 1).ReadAll();
document.getElementById('t1').value=strContents;
img_cont=Fileobject1.OpenTextFile(img_filename, 1).ReadAll();
document.getElementById('img2').src=img_cont;
}
else
{
alert('Employee Name Not found');
}}


function del_emp()
{
var filename=document.getElementById('del_emp').value;
var strFileName="c:\\vijay\\"+filename+".txt";
var img_filename="c:\\vijay\\"+filename+"_img.txt";
fileobj=new ActiveXObject("Scripting.FileSystemObject");
fileobj_img=new ActiveXObject("Scripting.FileSystemObject");
file_value=fileobj.GetFile(strFileName);
file_img_value=fileobj.GetFile(img_filename);
file_value.Delete();
file_img_value.Delete();
alert('File Deleted');
}