Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 21st, 2013, 2:03 AM   #1
acegreen
Newbie
 
Join Date: Aug 2013
Posts: 17
Rep Power: 0 acegreen is on a distinguished road
Incorporating php and js

Hi all -

I have the following js code:
<style>
	<!--
	body
	{
		font-family: "century schoolbook", serif;
		font-size: 20px;
	}
	.hidden 
	{ 
		display: none; 
		color: #000;  
		background: #FFFFFF;
	}
	.unhide 
	{ 
	 	display: block; 
		color: #000;
	}
	a.unhide
	{
		text-decoration: none; 
	}
	a.unhide:hover
	{
		text-decoration: underline; 
	}
	.unhide:hover 
	{
		background: #FFE5B4; 
		padding: 3px 8px; 
		display: table-row;
		transition: background .25s ease-in-out;
		-moz-transition: background .25s ease-in-out;
		-webkit-transition: background .25s ease-in-out;
	}
	-->
	</style>
	<script type="text/javascript">
		function unhide(divID) {
		    var item = document.getElementById(divID);
		    if (item) {
		        item.className = (item.className == 'hidden') ? 'unhide' : 'hidden';
		    }
		}
	</script>

...
<div class="conBoxcities">
	<class id="info">
		<a href="javascript:unhide('cityname');" class="unhide">
			This is really a js link with a city name. Clicking brings down information about that city.
		</a>
	</class>
	
	<class id="info"> 
		<div id="cityname" class="hidden">
			This is where the content of the above link appears. It is just an info blurb, basically.   
			This js script works here. On the other page it does not. I believe I messed up somewhere in my classes...please help
		</div>
	</class>
</div>

The above code works perfectly well on a "bare" php page

However - when I incorporate it into my main page, the js links no longer function. I believe i may have a mistake in my <class> arrangement (admittedly, classes and ids still confuse me).

This is the page where the link appears, but does not work.

Please help...

Last edited by The Dark; Sep 21st, 2013 at 7:16 PM. Reason: Added code tags
acegreen is offline   Reply With Quote
Old Sep 21st, 2013, 7:21 PM   #2
The Dark
Programming Guru

 
Join Date: Jun 2005
Posts: 1,631
Rep Power: 14 The Dark will become famous soon enoughThe Dark will become famous soon enough
Re: Incorporating php and js

Both pages work for me in Firefox. Was it a particular browser that it didn't work for?

Also, please use [code] tags for code, so it keeps the indentation
The Dark is offline   Reply With Quote
Old Sep 22nd, 2013, 9:56 AM   #3
Troncoso
Hobbyist Programmer
 
Join Date: Oct 2011
Posts: 127
Rep Power: 6 Troncoso is on a distinguished road
Re: Incorporating php and js

It works completely in:

IE 10.0.9200.16660
Firefox 22.0
Chrome 29.0.1547.76

It works in these browsers, but the link doesn't highlight in yellow like the others:

Safari 5.1.7
Opera 15.0.1147.148

So.....as Dark said, a browser where it doesn't work would be of help.
Troncoso is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
About learning PHP imigyjunia PHP 14 Nov 27th, 2012 3:25 AM
What is your preferred PHP editor? danieljames123 PHP 18 Jul 20th, 2011 8:14 PM
How to allow programation code PHP, HTML and JS in Posts gideaojs PHP 2 Jun 21st, 2011 6:13 AM
Frameworks & Learning PHP Aquarius6 PHP 0 Oct 4th, 2010 10:09 PM
PHP Uploader, Aiming for safety. brokenhope PHP 2 May 2nd, 2008 4:20 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:03 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC