Archive

Archive for November, 2009

Print content of a element

November 25, 2009 Leave a comment

If you want to print content of a html element, with the help of javascript you can do this.  You need to call  this function and pass a argument ( element id ). Take a look of this function.

<script type=”text/javascript”>
function printSelection(node){
var content=node.innerHTML
var pwin=window.open(”,’print_content’,’width=12800,height=1000, scrollbars=1′);
pwin.document.open();
pwin.document.write(‘<html><body onload=”window.print()”>’+content+'</body></html>’);
pwin.document.close();
//setTimeout(function(){pwin.close();},1000);
}
</script>

Now time to call this function. I called this function in a hyperlink like this.
<a href=”” onclick=”printSelection(document.getElementById(‘foo’));return false”>Print</a>

When you click on “Print” then print dialog appears give print command and enjoy this script.

Click here

Categories: Javascript

How to Add Fields in Registration Form

November 18, 2009 Leave a comment

soon!

Send mail through Joomla 1.5

November 18, 2009 Leave a comment

Joomla gives simple way to send e-mail. Do not need to write multi line code, write one line code and send e-mail. Follow these steps ..

Step 1. First of all include utility class if it is not included.
jimport(‘joomla.utilities.utility’);

Step 2. Now call this function :
JUtility:: sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachmentl, $replyto, $replytoname) ;

these are optional parameters
$mode=0, (default is ‘0’(zero) for plain text, 1 for html text)
$cc=null,
$bcc=null,
$attachment=null,
$replyto=null,
$replytoname=null

Joomla 1.5x Importent variable and object

November 10, 2009 Leave a comment

Receive variable:
$variable  =  JRequest::getCmd(‘name’, ‘default’, ‘hash’);
$variable  =  JRequest::getInt(‘name’, ‘default’, ‘hash’, ‘mask’);
$variable  =  JRequest::getString(‘name’, ‘default’, ‘hash’, ‘mask’);

Get database information through  database object:
$database  = &JFactory::getDBO();

Get Current user information through user object:
$user          = &JFactory::getUser();

Categories: Joomla 1.5

DOM

November 9, 2009 Leave a comment
1.) document.getElementById(‘id’): You can access virtually any element in            the DOM. Here is the syntax …
document.getElementById(‘id’)
Example:
a.) var obj    =    document.getElementById(‘id’);
alert(obj.value); {get value of a element}
alert(obj.title);  {get title of a element}
obj.style.color=’red’;  {Change color of a element}
b.) var obj    =    document.getElementById(‘id’).value;{get value of a element}
var obj1  =    document.getElementById(‘id).title; {get title of a element}

 

The different node methods available through DOM manipulation are as follows:
node.childNodes
node.firstChild
node.lastChild
node.parentNode
node.nextSibling
node.previousSibling
Categories: Javascript

Edit any website through javascript

November 7, 2009 2 comments

1.) Open a website which you want to edit.
2.) Now paste this code
“JavaScript:document.body.contentEditable=’true’; document.designMode=’on’; void 0”
in address bar then hit enter. Now you can write anything on this page.

3.) Note this is temporary.

Categories: Etc

Hide you file in jpeg

November 7, 2009 Leave a comment

1. Gather all the files that you wish to hide in a folder anywhere in your PC (make it in C:\hidden – RECOMMENDED).

2. Now, add those files in a RAR archive (e.g. secret.rar). This file should also be in the same directory (C:\hidden).

3. Now, look for a simple JPEG picture file (e.g. logo.jpg). Copy/Paste that file also in C:\hidden.

4. Now, open Command Prompt (Go to Run and type ‘cmd‘). Make your working directory C:\hidden.

5. Now type: “COPY /b logo.jpg + secret.rar output.jpg” (without quotes) – Now, logo.jpg is the picture you want to show, secret.rar is the file to be hidden, and output.jpg is the file which contains both.

6. Now, after you have done this, you will see a file output.jpg in C:\hidden. Open it (double-click) and it will show the picture you wanted to show. Now try opening the same file with WinRAR, it will show the hidden archive .

Categories: Etc

Object Oriented JavaScript

November 4, 2009 Leave a comment

Creating a class

Use object oriented javascript.
Below code write in .js file.
First of all declare a class. In JavaScript  class declaration same as function.
Let create a class in JavaScript
function MyClass(){
}
Now create a function in this class
function MyClass(){
this.firstFunction = firstFunction;
function firstFunction(){
alert(“I am from class”);
}
Now call the class function through object.  So we need to create object that
class.
var obj = new MyClass();
obj.firstFunction();

OutPut: A alert msg “I am from class”.