• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 118
  • Last Modified:

Javascript Not Happening

This code isn't working on the last one "rc"  I think it has to do with the hash=='#rc'.
<script type="text/javascript">
/* <![CDATA[ */
if(document.location.hash=='#ord')showhidesection('om');
else if(document.location.hash=='#list')showhidesection('gr');
else if(document.location.hash=='#add')showhidesection('am');
else if(document.location.hash=='#acct')showhidesection('ad');
else if(document.location.hash=='#rc')showhidesection('rc');
/* ]]> */</script>

Open in new window


<?PHP              
              // Your Records
?>			  <tr> 
                <td class="cobhl cobhdr" align="center" height="34" onclick="showhidesection('rc')"><a href="#"><strong><?php print $GLOBALS['xxYourRec']?></strong></a><a href="#" onclick="return false"><img id="sectimageom" src="images/arrow-down.png" style="float:right;margin-right:15px" /></a></td>
			  </tr>
			  <tr class="omformrow" style="display:none"> 
                <td class="cobll" height="34" align="center">
				  <table class="cobtbl" width="100%" border="0" cellspacing="1" cellpadding="3">
<?php		$hastracknum=FALSE;
			$sSQL = "SELECT ordID FROM orders WHERE ordClientID=" . $_SESSION['clientID'] . " AND ordTrackNum<>''";
			$result=ect_query($sSQL) or ect_error();
			if(ect_num_rows($result)>0) $hastracknum=TRUE;
			ect_free_result($result); ?>
					<tr><td class="cobhl"><?php print $GLOBALS['xxOrdId']?></td>
					<td class="cobhl"><?php print $GLOBALS['xxDate']?></td>
					<td class="cobhl"><?php print $GLOBALS['xxStatus']?></td>
<?php		if($hastracknum) print '<td class="cobhl">' . $GLOBALS['xxTraNum'] . '</td>'; ?>
					<td class="cobhl"><?php print $GLOBALS['xxGndTot']?></td>
					<td class="cobhl"><?php print $GLOBALS['xxCODets']?></td></tr>
                    <!--------------------------------------------------------------------------------------->			
<?php
			$sSQL = "SELECT clID,clUserName,clActions,clLoginLevel,clPercentDiscount,clEmail,loyaltyPoints FROM customerlogin WHERE clID=" . $_SESSION['clientID'];
			$result=ect_query($sSQL) or ect_error();
			if(ect_num_rows($result)>0){
				while($rs=ect_fetch_assoc($result)){
					print '<tr><td class="cobll">' . $rs['ordID'] . '</td>';
					print '<td class="cobll">' . date($dateformatstr, strtotime($rs['ordDate'])) . '</td>';
					print '<td class="cobll">' . $rs[getlangid("statPublic",64)] . '</td>';
					if($hastracknum) print '<td class="cobll">' . ($rs['ordTrackNum']!=''?$rs['ordTrackNum']:'&nbsp;') . '</td>';
					print '<td class="cobll">' . FormatEuroCurrency(($rs['ordTotal']+$rs['ordStateTax']+$rs['ordCountryTax']+$rs['ordShipping']+$rs['ordHSTTax']+$rs['ordHandling'])-$rs['ordDiscount']) . '</td>';
					print '<td class="cobll"><a class="ectlink" href="javascript:vieworder(' . $rs['ordID'] . ')">' . $GLOBALS['xxClkHere'] . '</a></td></tr>';
				}
			}else{
				print '<tr><td class="cobll" colspan="5" height="34" align="center">' . $GLOBALS['xxNoOrd'] . '</td></tr>';
			}
			ect_free_result($result);
?>
				  </table>

Open in new window

0
DS928
Asked:
DS928
  • 7
  • 6
1 Solution
 
Andrew DerseIT ManagerCommented:
Where are you setting the anchor part in this code?  I don't see any anchor part being set for 'rc'. Maybe that's why it's not working.
0
 
DS928Author Commented:
Not sure what you mean by anchor?  Is this it?
<script type="text/javascript">
/* <![CDATA[ */
var currstate=[];
currstate['ad']='none';
currstate['am']='none';
currstate['gr']='none';
currstate['om']='none';
currstate['rc']='none';
function showhidesection(sect){
	var elem=document.getElementsByTagName('tr');
	currstate[sect]=currstate[sect]=='none'?'':'none';
	for(var i=0; i<elem.length; i++){
		var classes=elem[i].className;
		if(classes.indexOf(sect+'formrow')!=-1) elem[i].style.display=currstate[sect];
	}
	document.getElementById('sectimage'+sect).src=currstate[sect]=='none'?'images/arrow-down.png':'images/arrow-up.png';
	return false;
}
/* ]]> */</script>

Open in new window

0
 
Andrew DerseIT ManagerCommented:
Nope.  You are using this javascript code:

document.location.hash=='#rc'

Open in new window


location.hash is used to point to an anchor in an HTML page...but I'm guessing that is not your goal.

What is your goal with your code?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DS928Author Commented:
It's being used to drop-down a menu header.  Go to www.mediascrubber.com  click on MyAccount
Enter rh@aol.com for the user name and RH1234 for the password.  A page with blue bars appears.  Order and Records seem to be tangled up.  When you click on Orders both open.  when you click on Records nothing opens.
0
 
Andrew DerseIT ManagerCommented:
This line is coming back null...it's missing the id you need...

document.getElementById('sectimage'+sect).src=currstate[sect]=='none'?'images/arrow-down.png':'images/arrow-up.png';

Open in new window

0
 
Andrew DerseIT ManagerCommented:
Can you paste the code you have for the order management section or all of the other sections?
0
 
DS928Author Commented:
Better yet here is the file.
incclientlogin.php
0
 
Andrew DerseIT ManagerCommented:
Ok, I think I found it.

Line item 921, the image id is the same as the om...change the image id to: sectimagerc and see if that works.

You have two id's for the same image...changing it might do the trick.
0
 
DS928Author Commented:
Didn't work
0
 
Andrew DerseIT ManagerCommented:
Did that get posted to the site?  So, I can verify the changes and see the new error?
0
 
Andrew DerseIT ManagerCommented:
You must be working on it now as it's displaying a little differently than before.  Well, I'm off to bed for today so tomorrow if it's not resolved, let me know and I'll peak at it more.  It most certainly seems like an id issue within the js.  Something isn't being passed correctly.
0
 
DS928Author Commented:
I changed in two places.

<img id="sectimagegr" src="images/arrow-down.png" style="float:right;margin-right:15px" /></a></td>
			  </tr>
			  <tr class="grformrow" style="display:none"> 

Open in new window

That worked.
0
 
DS928Author Commented:
Sleep tight!  Thank you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now