Wrox Programmer Forums
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2009, 02:37 AM
Registered User
 
Join Date: Aug 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem function

Code:
<html>
//this script is for table colors and make color row red when i click on it.
<style type="text/css">	
	/* These classes are used by the script as rollover effect for table 1 and 2 */	
	.tableRollOverEffect1{
		background-color:#cdffff;
		color:black;		
	}
	.tableRollOverEffect2{
		background-color:#cdffff;
		color:#black;		
	}
	.tableRowClickEffect1{
		background-color:#ff0000;
		color:#FFF;		
	}
	.tableRowClickEffect2{
		background-color:#ff0000;
		color:#FFF;
	}	
</style>
<script type="text/javascript">	
		var arrayOfRolloverClasses = new Array();
		var arrayOfClickClasses = new Array();
		var activeRow = false;
		var activeRowClickArray = new Array();	
		function highlightTableRow()
		{
			var tableObj = this.parentNode;
			if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

			if(this!=activeRow){
			this.setAttribute('origCl',this.className);
			this.origCl = this.className;
			}
			this.className = arrayOfRolloverClasses[tableObj.id];	
			activeRow = this;		
		}
	function clickOnTableRow()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;				
		if(activeRowClickArray[tableObj.id] && this!=activeRowClickArray[tableObj.id]){
			activeRowClickArray[tableObj.id].className='DOGODEK_ID';
		}
		this.className = arrayOfClickClasses[tableObj.id];		
		activeRowClickArray[tableObj.id] = this;				
	}	
	function resetRowStyle()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;
		if(activeRowClickArray[tableObj.id] && this==activeRowClickArray[tableObj.id]){
			this.className = arrayOfClickClasses[tableObj.id];
			return;	
		}		
		var origCl = this.getAttribute('origCl');
		if(!origCl)origCl = this.origCl;
		this.className=origCl;		
	}		
	function addTableRolloverEffect(tableId,whichClass,whichClassOnClick)
	{
		arrayOfRolloverClasses[tableId] = whichClass;
		arrayOfClickClasses[tableId] = whichClassOnClick;		
		var tableObj = document.getElementById(tableId);
		var tBody = tableObj.getElementsByTagName('TBODY');
		if(tBody){
			var rows = tBody[0].getElementsByTagName('TR');
		}else{
			var rows = tableObj.getElementsByTagName('TR');
		}
		for(var no=0;no<rows.length;no++){
			rows[no].onmouseover = highlightTableRow;
			rows[no].onmouseout = resetRowStyle;			
			if(whichClassOnClick){
				rows[no].onclick = clickOnTableRow;	
				
			}
		}		
	}
</script>

include ('table');
<script type="text/javascript">
addTableRolloverEffect('myTable','tableRollOverEffect1','tableRowClickEffect1');
addTableRolloverEffect('myTable2','tableRollOverEffect2','tableRowClickEffect2');
</script>
<script language="javascript">
//This code is for send ID from one table to another.
		function nad(DOGODEK_ID, DOGODEK_LINK_ID)
			{
				//alert("crm_dogodek.php?DOGODEK_ID=" + DOGODEK_ID );
				if (DOGODEK_LINK_ID != '') 
				{
				self.location.href  = 'crm_dogodek.php?DOGODEK_ID=' + DOGODEK_ID 
										+'&POD_ID='  + DOGODEK_ID;
				}		 
				else {
				self.location.href  = 'crm_dogodek.php?DOGODEK_ID=' + '' 
										+'&POD_ID='  + DOGODEK_ID;
				}										    
	        }
So I wont that code give to first java function. So then when I click on a table ID goes to another table but not with URL. Now I have to click on img src in a table and works but I wish to click on a row becouse i don't wont to have a pictures in a table.

THANK you
 
Old August 20th, 2009, 02:53 AM
jomet
Guest
 
Posts: n/a
Default

You post javascript releated issues in javascript forums
http://p2p.wrox.com/javascript-85/





Similar Threads
Thread Thread Starter Forum Replies Last Post
function problem lejka Java Basics 0 August 7th, 2009 02:31 AM
Problem with xpath function Phanikumar Biztalk 1 May 22nd, 2008 02:32 AM
Problem with function mat41 Classic ASP Basics 3 July 16th, 2005 01:19 AM
shell function problem bml Excel VBA 1 February 12th, 2005 05:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.