PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 2nd, 2004, 10:13 AM
Nookie Nookie is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 Nookie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php and javascript

i have to put the visible en hidden part in a loop and need some help.


<script type="text/javascript">
<!--
<?
$result = mysql_query($sql,$conn) or die("Couldn't do headings query");
while ($row = mysql_fetch_array($result)) {
$id = $row['headings_id'];

echo ('function showSubm'.$id.'(){
document.getElementById("subMItem'.$id.'").style.visibility="visible";
document.getElementById("subMItem'.$id.'").style.visibility="hidden";
}');
}
?>

i was thinking about using a array
so that i have to get the if formation from the db 1 time

ech time te first loop goes 1 up and the second loop repeat it self till db is empty than it goes back to the first loop.When Submid== subMItemid visibility will beste to visible else hidden.

regards.
Nookie

Reply With Quote
  #2  
Old February 5th, 2004, 05:57 PM
Volitics Volitics is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Knoxville, Tennessee (U.S.A.)
Posts: 58 Volitics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 15 sec
Reputation Power: 6
I'm not very familiar with JavaScript. But I've tried in the past combining PHP and JavaScript - I could not get it to work very well (or at all actually).

What you're trying to do may not be doable.
__________________
Thomas Jefferson: "Democracy will work only until the political incumbents discover they can perpetuate themselves in office by taxing the industrious to bribe the indolent."

Reply With Quote
  #3  
Old February 5th, 2004, 06:16 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
It is most definately possible to combine JAvascript and PHP... just takes a little understanding... remember that whatever PHP you include will be interpretted and the HTML/Javascript output sent to the browser... sometimes its hard to remember that... I've seen some people trying to call PHP functions from Javascript code (in the same document).... that's not possible

However, this doesn't directly relate to Nookie's problem...

Nookie,

It seems as though you plan on having a number of functions named showSubm1, showSubm2, showSubm3 and so on...

I propose a different way of handling this Javascript function... if all you plan on doing is showing a layer, why not simply pass the object as a parameter?

Code:
<script type="text/javascript">
	// based on your code
	function showSubm(item) {
		item.style.visibility="visible";
		item.style.visibility="hidden";
	}
</script>


then, where-ever you're calling it, use (for example) <div onclick="showSubm(this)">

Now, one issue I have with your code is... um... why are you setting the same object visible, then immediately hiding it?

Again, I wasn't all that clear on your question... Just simply adding my interpretation of your example =)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > php and javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway