|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Quote:
"target" is deprecated as attribute?
__________________
IkoTikashi - ikotikashi.de |
|
#17
|
||||
|
||||
|
Quote:
I changed to county3 and it still doesn't display anything... |
|
#18
|
||||
|
||||
|
country3 or $country3
Just asking the silly questions just to be sure. How about alter the updateBannerAdd() function to alert the contents of the variable passed to it. |
|
#19
|
||||
|
||||
|
Quote:
county3 (without the $) ... And you can ask silly questions if you like... as I'm sure you can tell, I'm an idiot with this... Not sure what you mean about the 2nd part of your response... alert the contents of the variable passed to it...? |
|
#20
|
|||||
|
|||||
|
javascript Code:
When updateBannerAdd is called on your webpage, you should get an alert with the value of county. About the county3 vs $county3, we are trying to get the contents of the php variable $county3 to be sent to the function. View your source of the completed page, and see what contents are in the specific function calls to make sure your populating that call correctly. |
|
#21
|
||||
|
||||
|
Quote: I tried adding the alert, and nothing happens... it seems as though nothing is happening (except for the menu expanding/collapsing) when the link is clicked... I viewed the source, and didn't see anything pertinent either... Here's the source: Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<link rel="stylesheet" href="./jquery.treeview.css" />
<link rel="stylesheet" href="./red-treeview.css" />
<link rel="stylesheet" href="screen.css" />
<link rel="stylesheet" href="um.css" type="text/css" />
<script src="./jquery.js" type="text/javascript"></script>
<script src="./jquery.cookie.js" type="text/javascript"></script>
<script src="./jquery.treeview.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#tree").treeview({
collapsed: true,
animated: "medium",
control:"#sidetreecontrol",
prerendered: true,
persist: "location"
});
})
</script>
<script type="text/javascript">
function updateBannerAdd(county3) {
alert(county+' is the value passed to updateBannerAdd()');
$.ajax({
type: "POST",
url: "yourbannerloader.php",
data: "county="+county,
success: function(msg) {
$('#bannerDiv').html(msg);
}
});
}
</script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<style type="text/css">
*{zoom:1;}
.treeview .hitarea{width:150px;}
</style>
</head>
<body>
<table class="logo">
<tr>
<td>
Logo and Banner stuff goes here
</td>
</tr>
</table>
<table class="nav">
<tr>
<td>
<a href="index.php">Home</a> | <a href="contact.php">Contact Us</a> | <a href="about.php">About Us</a> |
<a href="index2.php?string=<?php print ; ?>">Login / Register</a>
</td>
</tr>
</table>
<table style="width:780px;">
<tr>
<td class="leftcol">
Search<br />
<input type="text" />
<a href="#">Advanced</a>
<hr />
<div id="sidetree">
<div class="treeheader"> </div>
<div id="sidetreecontrol"> <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> </div>
<ul class="treeview" id="tree"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;"onclick="return false;">Florida</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="updateBannerAdd(county3); return false;">Alachua</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Gainesville</a></div><br /><ul style="display:none;"><li>Item 1</li><li>Item 2</li></ul></li></ul></li></ul><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="updateBannerAdd(county3); return false;">Hillsborough</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Tampa</a></div><br /><ul style="display:none;"><li>Item 4</li></ul></li></ul></li></ul><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="updateBannerAdd(county3); return false;">Marion</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Ocala</a></div><br /><ul style="display:none;"><li>Item 3</li></ul></li></ul></li></ul></li><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;"onclick="return false;">Georgia</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="updateBannerAdd(county3); return false;">Santa Rosa</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Gulf Breeze</a></div><br /><ul style="display:none;"><li>Item 5</li></ul></li></ul></li></ul></li></ul></div>
</td>
<td class="content">
</td>
<td class="rightcol">
<div id="bannerDiv"></div>
</td>
</tr>
</table>
</body>
</html>
|
|
#22
|
||||
|
||||
|
Sounds like this is turning into more of a JavaScript issue.
Because you mentioned "nothing happens except for the menu expanding/collapsing when I click the link", I'm pretty sure the problem is due to the fact that the treeview extension is binding a click event to the div.hitarea container, basically eliminating your onclick="" attribute in the link within the hitarea. First of all, remove the onclick="" attribute and add a rel="" attribute to your anchor. The rel attribute should contain the county name. Second, change your javascript implementation to match this. Make sure to copy and paste, as I've changed the updateBannerAd function slightly. (This is all untested and probably wont work, but its worth a shot.) PHP Code:
__________________
[read: PHP Security Guide | CSRF | PCRE Modifiers | Encryption | Form Processing | File Validation] [tools: PHPEd | PHP Docs | jQuery | CodeIgniter | Drupal | SwiftMailer | CKEditor | reCAPTCHA] Last edited by simshaun : June 30th, 2009 at 07:50 PM. |
|
#23
|
||||
|
||||
|
That made the folder tree into a yo-yo..
![]() Basically if I click to expand, it expands and then collapses right away... |
|
#24
|
||||
|
||||
|
It's been a long day and I'm fried, so I expected logic errors.
![]() Try this. PHP Code:
![]() Edit: Heading home now, so will get back with ya tomorrow. Last edited by simshaun : June 30th, 2009 at 08:16 PM. |
|
#25
|
||||
|
||||
|
Alright.. so the code that I mentioned doing the yo yo effect was actually my error... I didnt realize you had incorporated the treeview function as well.. so I commented that out and tried.... still didn't do anything... but wasn't opening and closing anymore.
So the code from your last post didn't work as posted... I did try changing hidden to visible and the outcome was: 1) When I clicked on state to expand, it popped up 3 alert boxes, one after another, all saying "County to load is undefined" 2) When I clicked either county or city, it popped up 1 alert box saying the same. I then tried changing county to county3, and instead of any popups, nothing beyond the county would drop down. Thanks again for all the help thusfar... |
|
#26
|
||||
|
||||
|
I don't suppose you could re-post the generated html that you have now (everything minus the php). This is something I'll have to play around with to get to work.
|
|
#27
|
||||
|
||||
|
ok, first there is a big problem we have to solve, and that is your still not populating the argument to pass to the updateBannerAdd() function call.
simshaun did a nice rework of the function so that it looks at the rel instead of waiting for the function call itself, so the question changes a bit, but still overall is the same. Are you populating the rel of the county anchor tab? Once we get a valid argument being passed into the function, we can easily do away with the unwanted alerts with a simple check against the incoming argument. But until we get to that point, it's better to leave the alert in there. From your last php code posted, updated to reflect our current direction: PHP Code:
|
|
#28
|
||||
|
||||
|
Quote:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Uncommon Marketplace</title>
<link rel="stylesheet" href="./jquery.treeview.css" />
<link rel="stylesheet" href="./red-treeview.css" />
<link rel="stylesheet" href="screen.css" />
<link rel="stylesheet" href="um.css" type="text/css" />
<script src="./jquery.js" type="text/javascript"></script>
<script src="./jquery.cookie.js" type="text/javascript"></script>
<script src="./jquery.treeview.js" type="text/javascript"></script>
<!--
<script type="text/javascript">
$(function() {
$("#tree").treeview({
collapsed: true,
animated: "medium",
control:"#sidetreecontrol",
prerendered: true,
persist: "location"
});
})
</script>
-->
<script type="text/javascript">
/**
* Declaration of updateBannerAd function.
*/
function updateBannerAd(county) {
alert('County to load is ' + county);
$.ajax({
type: "POST",
url: "yourbannerloader.php",
data: "county=" + county,
success: function(msg) {
$('#bannerDiv').html(msg);
}
});
}
$(function(){
$("#tree").treeview({
collapsed: true,
animated: "medium",
control:"#sidetreecontrol",
prerendered: true,
persist: "location",
toggle: function() {
var $ul = $(this);
if ($ul.is(":visible")) { // This may need to be
// if ($ul.is(":visible"))
var $anchor = $ul.parent().find(">.hitarea a");
updateBannerAd($anchor.attr('rel')); // Pass the anchor's rel attribute to the function.
}
}
});
});
</script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<style type="text/css">
*{zoom:1;}
.treeview .hitarea{width:150px;}
</style>
</head>
<body>
<table class="logo">
<tr>
<td>
Logo and Banner stuff goes here
</td>
</tr>
</table>
<table class="nav">
<tr>
<td>
<a href="index.php">Home</a> | <a href="contact.php">Contact Us</a> | <a href="about.php">About Us</a> |
<a href="index2.php?string=<?php print ; ?>">Login / Register</a>
</td>
</tr>
</table>
<table style="width:780px;">
<tr>
<td class="leftcol">
Search<br />
<input type="text" />
<a href="#">Advanced</a>
<hr />
<div id="sidetree">
<div class="treeheader"> </div>
<div id="sidetreecontrol"> <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> </div>
<ul class="treeview" id="tree"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Florida</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" rel="Alachua" onclick="return false;">Alachua</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Gainesville</a></div><br /><ul style="display:none;"><li>Item 1</li><li>Item 2</li></ul></li></ul></li></ul><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" rel="Hillsborough" onclick="return false;">Hillsborough</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Tampa</a></div><br /><ul style="display:none;"><li>Item 4</li></ul></li></ul></li></ul><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" rel="Marion" onclick="return false;">Marion</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Ocala</a></div><br /><ul style="display:none;"><li>Item 3</li></ul></li></ul></li></ul></li><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Georgia</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" rel="Santa Rosa" onclick="return false;">Santa Rosa</a></div><br /><ul style="display:none;"><li class="expandable"><div class="hitarea expandable-hitarea"><a href="#" style="margin-left:20px;" onclick="return false;">Gulf Breeze</a></div><br /><ul style="display:none;"><li>Item 5</li></ul></li></ul></li></ul></li></ul></div>
</td>
<td class="content">
</td>
<td class="rightcol">
<div id="bannerDiv"></div>
</td>
</tr>
</table>
</body>
</html>
@Onslaught: For the rel tag, I have it with the $ as well.... looks just like what you posted.... So far it seems I'm following along... Thanks again.. |
|
#29
|
||||
|
||||
|
is the alerts coming up with a valid county now?
|
|
#30
|
||||
|
||||
|
Quote:
No... The rel=$county declaration is how I had it yesterday... the alert says undefined... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > PHP-General - $_GET using an iframe |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|