WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP and javascript mouseover, mouseout, and mousedown events
Categories : PHP, Java Script, Form Processing, Beginner Guides Click here to Update Your Picture
Warren Gutierrez
Date : Aug 09th 2005
Grade : 2 of 5 (graded 8 times)
Viewed : 26844
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Warren Gutierrez
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

PHP and javascript mouseover, mouseout, and mousedown events

it works both on mozilla and IE:

<script language="javascript">
function SelectRowColor(rowevent,rown,rownum,pbgc,mbgc,dbgc) {
    var rows = document.getElementById(rown);
    var curcolor = null;
    var newcolor = null;
    var domDetect = null;

    if (typeof(window.opera) == 'undefined' && typeof(rows.getAttribute) != 'undefined') {
        curcolor = rows.getAttribute('bgcolor');
        domDetect = true;
    }else{
        curcolor = rows.style.backgroundColor;
        domDetect = false;
    }

    if(curcolor == '' || curcolor.toLowerCase() == dbgc.toLowerCase()) {
        if (rowevent == 'over' && pbgc != '') {
            newcolor = pbgc;
        }else if (rowevent == 'click' && mbgc != '') {
            newcolor = mbgc;
            sw[rownum] = true;
        }
    }else if (curcolor.toLowerCase() == pbgc.toLowerCase()&& (typeof(sw[rownum]) == 'undefined' || !sw[rownum])) {
        if (rowevent == 'out') {
            newcolor = dbgc;
        }else if (rowevent == 'click' && mbgc != '') {
            newcolor = mbgc;
            sw[rownum] = true;
        }
    }else if (curcolor.toLowerCase() == mbgc.toLowerCase()) {
        if (rowevent == 'click') {
            newcolor = (pbgc != '') ? pbgc : dbgc;
            sw[rownum] = (typeof(sw[rownum]) == 'undefined' || !sw[rownum]) ? true : null;
        }
    }

    if (newcolor) {
        if (domDetect) {
            rows.setAttribute('bgcolor', newcolor, 0);
        } else {
            rows.style.backgroundColor = newcolor;
        }
    }
}
</script>


you can invoke the function by adding the following lines:

<?php
$bgcolor
= "#D7DEDE";
$pointcolor = "#A1C3C9"
$markcolor = "#FF9C71";

Echo
"
<tr bgcolor=\""
.$bgcolor."\" onMouseOver=\"SelectRowColor('over','tr".$i."','".$i."','".$pointcolor."','".$markcolor."','".$bgcolor."')\" onMouseOut=\"SelectRowColor('out','tr".$i."','".$i."','".$pointcolor."','".$markcolor."','".$bgcolor."') onMouseDown=\"SelectRowColor('click','tr".$i."','".$i."','".$pointcolor."','".$markcolor."','".$bgcolor."')\" >
"
;
?>



Upload any fixed type of files, control file type through javascript and encrypt filename using php so file not get overwrite
Categories : PHP, Java Script, Functions, PHP References, Form Processing
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
Changing the Style of form objects using the JavaScript OnClick method.
Categories : Java Script, Form Processing, Beginner Guides, CSS
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
Easy alert box pop-up function
Categories : PHP, Java Script, Beginner Guides
Form Validation Using PHP to highlight non valid fields
Categories : PHP, Form Processing, Data Validation, Beginner Guides
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Classic guest book made with PHP and Flash
Categories : PHP, Flash, Java Script