Solved

Javascript Not Happening

Posted on 2015-01-29
13
112 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 13

Expert Comment

by:Andrew Derse
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:Andrew Derse
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
Independent Software Vendors: 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!

 

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:Andrew Derse
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:Andrew Derse
ID: 40579048
Can you paste the code you have for the order management section or all of the other sections?
0
 

Author Comment

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

Accepted Solution

by:
Andrew Derse 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:Andrew Derse
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:Andrew Derse
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

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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