WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : 36165
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  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."')\" >
"
;
?>



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
Show hide table rows to make dynamic forms
Categories : Beginner Guides, Java Script, Form Processing, HTTP
JavaScript dropdown list menu to switch any page.
Categories : Java Script, Beginner Guides, Form Processing
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
Form Processing : with alert Highlight field name which is not filled by user
Categories : Java Script, Form Processing, Data Validation, Beginner Guides, Web Design
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Easy alert box pop-up function
Categories : PHP, Java Script, Beginner Guides
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, 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
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
Classic guest book made with PHP and Flash
Categories : PHP, Flash, Java Script
Simple db results paging example
Categories : PHP, MySQL, Databases, Form Processing