-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
extra divs, spans stop tooltips from working HELP
Adam replied to TeddyKiller's topic in Javascript Help
I don't really understand why, whoever wrote this script, they chose to use the spans and inputs in this way; seems very fallible. I guess you could either change the additional span you've added to a different tag, or try to modify the code by selecting the span.hint element specifically, as opposed to just every span contained within 3 parent nodes of an input. Personally I'd consider ditching this script all together. -
extra divs, spans stop tooltips from working HELP
Adam replied to TeddyKiller's topic in Javascript Help
Just looked at the function properly: this.parentNode.parentNode.parentNode.getElementsById("span")[0].style.display = "inline"; "getElementsById()" - is this a custom method you've implemented, or part of a framework or something? -
As in when you view the HTML source, is the PHP output there? By masked I meant defective CSS forcing the header or footer to literally cover up - mask - the output. Did you even try ignace's suggestion?
-
Well theoretically that condition should be run no matter what; given that there's no syntax errors reported and not a single "return" within the preceding code. Are you sure the function is actually being called? Try adding an alert at the start of the function: function get_user_info() { alert('foo');
-
extra divs, spans stop tooltips from working HELP
Adam replied to TeddyKiller's topic in Javascript Help
Sorry, I missed the addLoadEvent(prepareInputsForHints) call before. The problem is essentially the same as before. What you need to do is provide the correct path to the parent element containing the span hint (the fieldset). So from the input, now being wrapped within an extra span and div, you need to go 2 parentNodes further up: function prepareInputsForHints() { var inputs = document.getElementsByTagName("input"); for (var i=0; i<inputs.length; i++){ inputs[i].onfocus = function () { this.parentNode.parentNode.parentNode.getElementsById("span")[0].style.display = "inline"; } inputs[i].onblur = function () { this.parentNode.parentNode.parentNode.getElementsByTagName("span")[0].style.display = "none"; } } } -
Is it visible within the source? Perhaps the styles in your template are masking it..
-
If you comment out the setCookie() line with how the code is now, what happens?
-
Try add this else statement: if (document.getElementById("header_sub")) { start_timer(); } else { alert("element doesn't exist!"); }
-
A pretty classic example of why indentation is so useful: function get_user_info() { for (i = 0; i < document.getElementsByTagName("table").length; i++) { var table_temp = document.getElementsByTagName("table")[i]; if (table_temp.rows[0].cells.length == 2) { if (document.getElementsByTagName("table")[i + 1].rows[0].cells[0].innerHTML.search("Income") > 0 && document.getElementsByTagName("table")[i + 1].rows[0].cells[2].innerHTML.search("Private Messages") > 0) { if (table_temp.rows[0].cells[0].innerHTML.search("i/w/blink.gif") > 0) { var newdiv = document.createElement("div"); newdiv.setAttribute("ID", "mp3_mail"); newdiv.style.visibility = "hidden"; newdiv.style.position = "absolute"; newdiv.style.left = 0; newdiv.style.top = 0; document.body.appendChild(newdiv); document.getElementById("mp3_mail").innerHTML = "<embed width=0 height=0 hidden='true' autostart='true' volume='100' loop='false' src='" + mp3_mail + "'>"; } var user_money = document.getElementsByTagName("table")[i + 2].rows[0].cells[0].innerHTML.replace(/^\s+|\s+$|,/g, "").replace(" $", ""); var user_food = document.getElementsByTagName("table")[i + 2].rows[0].cells[2].innerHTML.replace(/^\s+|\s+$|,/g, "").replace(" F", ""); var user_power = document.getElementsByTagName("table")[i + 2].rows[0].cells[4].innerHTML.replace(/^\s+|\s+$|,/g, "").replace(" P", ""); var user_turns = document.getElementsByTagName("table")[i + 2].rows[0].cells[6].innerHTML.replace(/^\s+|\s+$|,/g, "").replace(" T", ""); var user_server = document.getElementsByTagName("table")[i + 2].rows[0].cells[8].innerHTML.replace(/^\s+|\s+$|,/g, ""); var user_name = document.getElementsByTagName("table")[i + 2].rows[0].cells[10].innerHTML.replace(/^\s+|\s+$|,/g, ""); if (document.getElementById("current_turns")) { document.getElementById("current_turns").innerHTML = user_turns; } if (user_server === "RT") { var server_speed = 8; var server_max_turns = 30; } if (user_server === "Ultra") { var server_speed = 120; var server_max_turns = 100; } if (user_server === "Fast") { var server_speed = 300; var server_max_turns = 150; } if (user_server === "Normal") { var server_speed = 900; var server_max_turns = 180; } if (user_server === "Slow") { var server_speed = 1800; var server_max_turns = 250; } user_turns = current_time("U") - user_turns * server_speed; var build_server_userbar = "username|" + user_name + "[#]money|" + user_money + "[#]food|" + user_food + "[#]power|" + user_power + "[#]turns|" + user_turns + "[#]server|" + user_server + "[#]server_speed|" + server_speed + "[#]server_max_turns|" + server_max_turns; setCookie("user_server_info", build_server_userbar, 365); } } } if (document.getElementById("header_sub")) { start_timer(); } } Edit: By the way I just used the first online JavaScript tidier I could fine, think you've lost your comments.
-
extra divs, spans stop tooltips from working HELP
Adam replied to TeddyKiller's topic in Javascript Help
Okay this is all over the place. The first HTML snippet you gave calls a password validation function, the next - with "a few extra bits" - calls a username validation function. Then you've posted another function that I can't actually see a call to anywhere in the code you've provided. Could you lay things out a little simpler please? -
So to be clear, you want to call the start_timer() method - assuming the #header_sub element can be returned - regardless of what happens within the rest of the function?
-
Could you elaborate on "nothing appear"? i.e. Is it a blank page? Does the PHP not display (or not display as expected)?, etc.
-
extra divs, spans stop tooltips from working HELP
Adam replied to TeddyKiller's topic in Javascript Help
You're wrapping the input within another 2 elements, so the parent element isn't the fieldset anymore. Change this line of the JS: var fieldset = whatYouTyped.parentNode; To: var fieldset = whatYouTyped.parentNode.parentNode.parentNode; -
Sorry that snippet's just too out of context to figure out the problem. Could you post the whole function?
-
Sounds like there's could be a syntax error within start_2(). Does anything show up in the error console?
-
You could loop through them as teamatomic has suggested, but do you not think (as it's only the last 3 months you need) a better trade off for readability would be to just create the array manually? $last_3_months = array( date("F 1, Y", strtotime("- 1 month")), date("F 1, Y", strtotime("- 2 months")), date("F 1, Y", strtotime("- 3 months")) );
-
Please help me repair this code php export to xml file.
Adam replied to thuythu1's topic in PHP Coding Help
Sorry, that should be $books->(...) -
Please help me repair this code php export to xml file.
Adam replied to thuythu1's topic in PHP Coding Help
When you create the books element, store the returned node so that you're able to append a child to it: $books = $doc->appendChild($doc->createElement('books')); Then using the returned node, append the booklist child to it: $blist = $book->appendChild($doc->createElement('booklist')); Then instead of appending the fragmented node to the root/books element (the "documentElement"), append it to the booklist element: $blist->appendChild($f); Should work as you want after that. -
Do you Want to join on a php newies group to learn online self tought class?
Adam replied to co.ador's topic in Miscellaneous
Again as somebody mentioned, putting a group of people in the same situation wouldn't really help. When teaching yourself there's no real order in which to learn, you just have to go out and figure it out for yourself; which would probably be beneficial in that situation as you'll learn more in the long run. -
Not necessarily, he needs 326 seats otherwise we've got a hung parliament. If Gordon Brown makes a deal with several other parties Labour may still stay in power, or at least keep the majority. I'm not sure if Gordon Brown will remain PM though, I think everyone hates him.. [attachment deleted by admin]
-
Read up on doctypes and how they effect the presentation of a web page. Most likely the doctype you're using doesn't allow something within the JS.
-
The PHP manual contains some good snippets using the readdir function, use this as a starting point. Then pass the current directory through the URL; take serious notice though this could be a huge hole in security if not done right.
-
Evidently this goose has been with them for sometime.
-
After a quick look I couldn't really spot anything of concern with PHP4/5 migration, looks like you may be depending on "register globals" in some areas though - assuming that's all of the code - but that shouldn't be enabled with PHP4.4.8 anyway. I'm not saying the code's fine though, certainly could do with being re-written.