Solved

Javascript Not Happening

Posted on 2015-01-29
13
107 Views
Last Modified: 2015-01-29
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
Comment
Question by:DS928
  • 7
  • 6
13 Comments
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579006
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
 

Author Comment

by:DS928
ID: 40579013
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
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579018
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
 

Author Comment

by:DS928
ID: 40579041
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
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579044
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
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579048
Can you paste the code you have for the order management section or all of the other sections?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:DS928
ID: 40579056
Better yet here is the file.
incclientlogin.php
0
 
LVL 13

Accepted Solution

by:
NUKIT earned 500 total points
ID: 40579058
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
 

Author Comment

by:DS928
ID: 40579065
Didn't work
0
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579073
Did that get posted to the site?  So, I can verify the changes and see the new error?
0
 
LVL 13

Expert Comment

by:NUKIT
ID: 40579085
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
 

Author Comment

by:DS928
ID: 40579089
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
 

Author Closing Comment

by:DS928
ID: 40579090
Sleep tight!  Thank you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now