+ Reply to Thread
Results 1 to 2 of 2

Thread: Some nice-simple JavaScript effects !!

  1. #1
    careerbridge's Avatar
    careerbridge is offline x10 Sophmore careerbridge is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    India
    Posts
    126

    Thumbs up Some nice-simple JavaScript effects !!

    Hi friends,

    This thread is for those who interested in making their site more interesting with some simple JavaScript codes and for those who wish to share their nice ideas with other x10 members. So, if you have some nice codes, please post here....

    Ok, here is a very simple code for image hover effect !! ( I am a beginner in JavaScript and correct me if I am wrong)

    JavaScript
    Code:
    <script type="text/javascript">
    function sChange(mID){
        mItem=document.getElementById(mID);
        mItem.width=mItem.width*1.10;
        mItem.height=mItem.height*1.10;
    }
    function sRestore(mID){
        mItem=document.getElementById(mID);
        mItem.width=mItem.width*0.91;
        mItem.height=mItem.height*0.91;
    }
    </script>
    HTML
    Code:
      <img src="browse.png" id="img1" onmouseover="sChange('img1')" 
    onmouseout="sRestore('img1')" />


    Details : Here we got an image (id="img1"). On the mouseover and mouseout events we are calling two JavaScript functions sChange() and sRestore(). We are giving the image id as the parameters for the function. And inside the function we are using document.getElementById() function to get the image object. Now we change change any properties of the object (here the height and width)


    Want to see this code in action ?? go here....http://h1.ripway.com/careerbridge/hover.html

    Or go to my home page to see a practical example (at the bottom of the page)... http://careerbridge.edu.ms/


  2. #2
    zx666's Avatar
    zx666 is offline x10Hosting Member zx666 is an unknown quantity at this point
    Join Date
    Jul 2006
    Posts
    2

    Re: Some nice-simple JavaScript effects !!

    Quote Originally Posted by careerbridge
    Hi friends,

    This thread is for those who interested in making their site more interesting with some simple JavaScript codes and for those who wish to share their nice ideas with other x10 members. So, if you have some nice codes, please post here....

    Ok, here is a very simple code for image hover effect !! ( I am a beginner in JavaScript and correct me if I am wrong)

    JavaScript
    Code:
    <script type="text/javascript">
    function sChange(mID){
        mItem=document.getElementById(mID);
        mItem.width=mItem.width*1.10;
        mItem.height=mItem.height*1.10;
    }
    function sRestore(mID){
        mItem=document.getElementById(mID);
        mItem.width=mItem.width*0.91;
        mItem.height=mItem.height*0.91;
    }
    </script>
    HTML
    Code:
      <img src="browse.png" id="img1" onmouseover="sChange('img1')" 
    onmouseout="sRestore('img1')" />


    Details : Here we got an image (id="img1"). On the mouseover and mouseout events we are calling two JavaScript functions sChange() and sRestore(). We are giving the image id as the parameters for the function. And inside the function we are using document.getElementById() function to get the image object. Now we change change any properties of the object (here the height and width)


    Want to see this code in action ?? go here....http://h1.ripway.com/careerbridge/hover.html

    Or go to my home page to see a practical example (at the bottom of the page)... http://careerbridge.edu.ms/

    Nice, thx that will help me :D

+ Reply to Thread

Similar Threads

  1. simple script
    By swirly in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 06-17-2006, 06:32 PM
  2. [PS] Making Simple Borders
    By moose in forum Tutorials
    Replies: 0
    Last Post: 03-22-2006, 08:20 AM
  3. javascript
    By Brandon in forum Off Topic
    Replies: 6
    Last Post: 01-20-2006, 04:49 PM
  4. [OFFER] Simple but nice custome website.
    By NielsJanssen in forum The Marketplace
    Replies: 0
    Last Post: 10-02-2005, 07:09 AM
  5. New Simple Sig
    By phenetic in forum Graphics & Webdesign
    Replies: 2
    Last Post: 02-23-2005, 08:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers