|
|
|
|
|
|
| |
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 | |
|
|