Jump to content

vincea

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vincea's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for the quick reply!. I think i phrased the topic wrong though. I need to get the text within a tag by the attribute VALUE. i.e. class="fooclass" i would be searching by "fooclass". Thanks again,
  2. Hey everyone, First off I hate reg expressions so I thought I would try a search which came up empty, so I might as well ask for help. Since MLS.ca doesn't believe in showing real estate feeds with XML but with tables (ugh) I need to find certain (sometimes nested) HTML tags with certain attributes. an example would be: <div class="Text">I need the text in here</div> however that tag may be nested within a table structure. my function looks like so where $content is the html source but again i have no regex: function read_value ($content, $tag, $attr) { if ($content == "") { echo "Feed contains no content to be parsed"; } if ($attr != "") $found = preg_match('//', $content, $matches); else echo "No attribute specified"; if ($found != false) return $matches[0]; // matches found: return them else return false; // no matches found: return false }
  3. I actually figured this out without doing anything. So if anyone needs a script to run a Get request from a form.. I suggest: http://projects.aphexcreations.net/ajform/ works really well.
  4. Hey everyone, I always use the AJAX GET request to then make a request to a PHP document.. works great but before I haven't done it with the form behind a table. Here is an example of what I mean. the html: <form name="blah" id="blah"> <table> <tr> <td><input type="text" name="blah2" id="blah2"></td> </tr> <tr> <td><input type="button" name="submitit" value="submitme!" onclick="get(this.parentNode);"></td> </tr> </table> </form> the js: function get(obj) { var getstr = "?"; for (i=0; i<obj.childNodes.length; i++) { if (obj.childNodes[i].tagName == "INPUT") { if (obj.childNodes[i].type == "text") { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } else { getstr += obj.childNodes[i].name + "=&"; } } if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } } } if (obj.childNodes[i].tagName == "SELECT") { var sel = obj.childNodes[i]; getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&"; } if (obj.childNodes[i].tagName == "TEXTAREA") { var sel = obj.childNodes[i]; getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&"; } makeRequest('thephp.php', getstr); } } I can never get this to work from behind a table. Mostly because the childNodes picks up the table Nodes and not the form Nodes. Any idea is greatly appreciated.
  5. Good idea.. i don't know why i always make things so difficult to begin with.. I will try that. Thanks again.
  6. thanks that works great and cleans up my ugly code but still I need it when the checkbox is Unchecked now remove it from the text box or string so it isn't part of the mass email
  7. I am creating a newsletter management system and what I want it to do is list all the subscribers and their email addresses from the database. Beside each, a checkbox.. when the checkbox is "checked" it will add onto a string that will be the complete recipient list. Right now I have if the box gets checked (with an "onchange") it will put that box value (email address) into a textbox. If Unchecked it will remove the e-mail from the textbox. here is some code: function getChecks() { count = document.nl_subs.elements.length; for (i=0; i < count; i++) { if(document.nl_subs.elements[i].checked == true) { document.getElementById("recipients").value += document.nl_subs.elements[i].value + ","; } } } I know this is way off.. cuz right now it is getting ALL the checkboxs that are checked and adding them into the textbox. Here is the html & php: $sub_check is the number (1, 2, 3 etc) <input type="checkbox" name="sub_check<? echo $sub_check ?>" value="<? echo $email ?>" onchange="getChecks()"/> I tried using the getChecks(this.name) do just do the ONE checkbox but i couldnt get it to work. so for the ONE checkbox i had something like: function getChecks(element) { checkbox = document.nl_subs.element; if(document.nl_subs.checkbox.checked == true) { document.getElementById("recipients").value += document.nl_subs.element.value + ","; } } any help is appreciated.
  8. and if they want to know, they will find out eventually. i see no point unless your code contains identity or life threatening information.
  9. I'm having the same problem.. i think. I have an index page and I have links for "members" in the navbar. When a link is pressed the member info with AJAX is loading into a container on the index.php, the data in the container (member.php) contains javascript with both includes and some script in it. Javascript won't work for me either. I even tried running a Thickbox (Cody Lindley's Thickbox) from the link but it won't run the javascript either. ???
  10. yes i know i tried that... then in the onclick link i used a function to set display to block but then it just appears, so the point of using the blind effect from the jquery library was pointless. the onclick: [code]<li><a href="#" alt="Active Members" onClick="$('#sub').BlindToggleVertically(1000, null, 'bounceout');">Active Members</a></li>[/code] the css: [code]#sub2 li a { font-size: 12px; width: 140px; display: block; margin: 0 0 0 420px; padding: 0 0 0 5px; background: #333333; opacity: .8; }[/code] the problem is.. the display is in a "li a" so using a function say for example: [code] function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'none') e.style.display = 'block'; else e.style.display = 'none'; } [/code] doesn't work because it will only change the display for "#sub {" not "#sub li a {" anyone?
  11. Hey everyone, Got a question: i'm running some menus using the jquery toolkit effects and when I load the page obviously they are in their "down" state. I have tried the body onload="" and setting the divs to "display:none" onload. Although this is a logical solution the divs flicker onload because they are going from display: block to display:none and I don't want that. Is there a different way to do this? maybe a way to collapse the menus on load, i dont know.  am i confusing anyone? i know i am confusing myself. lol
  12. hahaha good eye.. i overlooked that.. i'm retarded. Ok i will give that a shot
  13. Ok well this is a basic script.. but won't work in IE. Works in Opera, Navigator, Firefox but not in IE.. of course. Basically all it does is load a .php file when the link is clicked making Ajax show the .php file in a <div> BUT IE refuses to co-operate with the text link command, I have tried different variants and still nothing. It is IE 6. the code.... The menu link in the body of the page which submits the php file and the div ID [code]<li><a href="#" onClick="getData('member.php?mem=mike', 'contentContainer')">&raquo; Mike</a></li>[/code] and here is the basic XMLHttpRequest object in the head.. [code] var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { HttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } function getData(dataSource, divID) { if (XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 1) { obj.innerHTML = "<div id='load'>Loading.. <img src='spinner.gif'></div>"; initLightbox(); } if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } } [/code] Any help would be great... Vince
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.