NoDoze Posted May 8, 2009 Share Posted May 8, 2009 I'm forging a new direction here for me, combining all these languages...so please bare with me.... I am having a onmouseover enable the appearance of a table of mysql data. I have the onmouseover working so the table appears, but I'm having trouble getting the table to disappear with the onmouseout. This is what I have" selectuser.js var xmlHttp; function showUser(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="getuser.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("blurb").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } Being called via this: <span class="link" onMouseOver="showUser(4)" onMouseOut="hideUser(4)">more info</span> I've tried every combination of onmouseout and hideuser....please help! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/ Share on other sites More sharing options...
NoDoze Posted May 8, 2009 Author Share Posted May 8, 2009 sigh... I don't understand why it's not working... I've even tried not counting the hide, and just have the data appear but even that I still get nothing echo "<span class='link' onClick='showUser(".$row['blurbnum'] .")'>more info</span>"; Doesn't work Any direction or help is appreciated, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-829924 Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 Is there an element with ID blurb? Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-829945 Share on other sites More sharing options...
xtopolis Posted May 9, 2009 Share Posted May 9, 2009 If you're having trouble with the actual div showing and hiding, you can take a look at source of my site: http://www.xtopolis.com . You'll see at the bottom right, I have mouseover/out effects that may be what you're looking for. specifically this javascript file: http://xtopolis.com/_common/ajax/index.js Example link: <a href="javascript: void(0);" onmousemove="return displayToolTip(event,'tt_div','by X5s',-20,25,'#000000')" onmouseout="return hideTooltip(event)">Text</a> Example div: <!--USED FOR TOOLTIPS--> <div id="tt_div" style="visibility: hidden;"></div> Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-829998 Share on other sites More sharing options...
NoDoze Posted May 9, 2009 Author Share Posted May 9, 2009 Yes, I've looked at your ref xtopolis... But my JS is runing a php file which opens a table with mysql data. How do I combine the two, the view/hide AND the php/mysql...? I could get it to view, but not hide.... Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-830103 Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 Modify this function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("blurb").innerHTML=xmlHttp.responseText; } } to function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { var blurb = document.getElementById("blurb"); blurb.innerHTML=xmlHttp.responseText; blurb.style.display = ''; } } Then define your hideUser function as such: function hideElement (id) { var dom = document.getElementById(id); dom.innerHTML = ''; dom.style.display = 'none'; } Finally, the URL to be: <span class="link" onMouseOver="showUser(4)" onMouseOut="hideElement('blurb');">more info</span> Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-830107 Share on other sites More sharing options...
NoDoze Posted May 9, 2009 Author Share Posted May 9, 2009 ok, cool, it works! Thanks! ...but... ..it only works on a new blank page...when I insert the link part into the site, the blurb appears, but doesn't disappear... The difference between the two? " vs ' In the actual page, it's an echo so the quote need to be ' inorder for the page to show up correctly...and the blurb doesn't disappear... echo "<span class='link' onMouseOver='showUser(2)' onMouseOut='hideElement('blurb');'>more info</span><div id='blurb'></div>"; Any ideas around this one....? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-830139 Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 Try - echo "<span class='link' onMouseOver='showUser(2)' onMouseOut='hideElement(\"blurb\");'>more info</span><div id='blurb'></div>"; Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-830140 Share on other sites More sharing options...
NoDoze Posted May 9, 2009 Author Share Posted May 9, 2009 Cool! The infamous forward slash did the trick! Forgot about that! Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-830142 Share on other sites More sharing options...
NoDoze Posted May 12, 2009 Author Share Posted May 12, 2009 Ok, I have a new problem...Originally this page was short, but now so much content has been added you now have to scroll. With the way the mouseover script was writen above, the popup was at a fixed location. Is there a way to get the popup to appear next to the link or mouse? I googled it, and found tooltip? ...it that what I want to do/use? How could I or would I change the above script to use tooltip? onmouseover='tooltip(\"staffblurb.php\")' It's got to be something more to it than that, right? And the selectuser.js file would have to change too, right? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-832852 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Is there a way to get the popup to appear next to the link or mouse? Yes. I googled it, and found tooltip? ...it that what I want to do/use? How would I know. How could I or would I change the above script to use tooltip? Again, how would I know. It's got to be something more to it than that, right? Don't know. And the selectuser.js file would have to change too, right? Don't know that either. If you found something, it's helpful to be specific and possibly highlight some code if it's very long. Otherwise, we have no idea what that tooltip script does and ultimately, we can't help you. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-832875 Share on other sites More sharing options...
NoDoze Posted May 13, 2009 Author Share Posted May 13, 2009 Did you even read my previous posts...? ...cause all the files and code I'm speaking of are already posted above! Do I have to re-post it for you...? Well here you go.... Quote from: NoDoze on Yesterday at 06:45:48 PM Is there a way to get the popup to appear next to the link or mouse? Yes. Well, how would I do it!?! Quote from: NoDoze on Yesterday at 06:45:48 PM I googled it, and found tooltip? ...it that what I want to do/use? How would I know. Like I said, I found tootip, but how would I implement it? ...in layman's terms, how would I use it? Quote from: NoDoze on Yesterday at 06:45:48 PM How could I or would I change the above script to use tooltip? Again, how would I know. Cause if you bothered to scroll up you would see: URL <span class="link" onMouseOver="showUser(4)" onMouseOut="hideElement(\"blurb\");">more info</span> Quote from: NoDoze on Yesterday at 06:45:48 PM It's got to be something more to it than that, right? Don't know. ...simple question.... Quote from: NoDoze on Yesterday at 06:45:48 PM And the selectuser.js file would have to change too, right? Don't know that either. Again, if you bothered to scroll up you would see: selectuser.js var xmlHttp; function showUser(str) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="getuser.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("blurb").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } If you found something, it's helpful to be specific and possibly highlight some code if it's very long. Otherwise, we have no idea what that tooltip script does and ultimately, we can't help you. Yea, if you bothered to read the ENTIRE post you'd know what I was talking about... And yea, it helps both of us to not be a smart aleck about it...so spare me... I come here for genuine help and hopefully have some questions answered...and every bit is appreciated. Now, can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833415 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Did you even read my previous posts...? Did you!? There isn't anything related to tooltip. It's like me asking you for help about this - onmouseover="redo('someID');" without showing you the function redo() or describing what it does. How would you help me? Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833423 Share on other sites More sharing options...
NoDoze Posted May 13, 2009 Author Share Posted May 13, 2009 Read ABOVE please, I edited it so it's in ENGLISH....so I could help you. I googled it, and found tooltip? ...it that what I want to do/use? Like my question states! WHAT IS TOOLTIP! sigh.... I know you are the ALL GREAT KNOWING about this stuff...I'm not. So perhaps it all makes sense to you....it doesn't for me. Im trying to understand.... I'm asking for help...can you help? Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833435 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Look, I'm just trying to help. I'm not going to argue with you. If you read carefully, your quoted question asked if that's what you wanted to use or something about if that's what you want to do. You didn't ask what it is. You just asked if you should be using it or at least that's how I took that question into meaning. I know you asked if you can use tooltip and how you would use it. The matter of the problem is I can't answer your queries because you haven't shown me the tooltip code. There are so many variations of a tooltip. And you said you Googled it, but you haven't shown it to me. Do you expect me to Google it and coincidentally find the same one you're looking at? You can use a tooltip. But I can't help you in using it because as stated for the umpteenth time, I have no idea what tooltip code you're using. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833450 Share on other sites More sharing options...
NoDoze Posted May 13, 2009 Author Share Posted May 13, 2009 OMG!! Like I said, I have no idea what it does, I have no idea how to use it, I have NO idea what it is!!! So how would I show u code, if I have no idea how to use it in code!?!?!?!?!?! Yea, I googled it, but again, it only describes something that I want to do...no code. http://en.wikipedia.org/wiki/Tooltip So your asking me to do something I HAVE NO CLUE ABOUT! I guess this forum is for more advanced coders... newbies like me can't just ask, what is it? But apparently need to supply code....SORRY! MY FAULT! I'll find some other forum that more geared to newbies... Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833468 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Ok, I have a new problem...Originally this page was short, but now so much content has been added you now have to scroll. With the way the mouseover script was writen above, the popup was at a fixed location. Is there a way to get the popup to appear next to the link or mouse? I googled it, and found tooltip? ...it that what I want to do/use? How could I or would I change the above script to use tooltip? onmouseover='tooltip(\"staffblurb.php\")' It's got to be something more to it than that, right? And the selectuser.js file would have to change too, right? Thanks! I believe this all started here. So I'll re-iterate - in reply to the quoted post above. You asked me how you would change your script to use tooltip. Is that possible for me to answer in the first place? I wouldn't know if that mouseover is correct because I don't know what the function tooltip does. And regarding the change to selectuser.js, how would I know? I imagined you called tooltip in mouseover like that because you thought it was a built-in function. How would I know you didn't know what it did. Before that post, you showed no indication of not knowing about tooltip. It was after that post that you told me you don't know what tooltip is. Even advanced coders are not psychic. Edit - I think I'll step down from this topic and let others help. I rather not get into an argument over such silly things. I am sorry for everything I said before and I'll take it all back. Have a good day and good luck with this. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833478 Share on other sites More sharing options...
NoDoze Posted May 13, 2009 Author Share Posted May 13, 2009 Wow...amazing... You're not psychic? Hello!?! I said I found it via google! As if it was the first time for me to hear about it, maybe? I googled it, and found tooltip? The question mark USUALLY indicates a question, right? As in "...and found tooltip?" Maybe I should have just put "tooltip?" alone, singularly, so it'd be less complicated...? A question is used when someone wants to know more about something last I checked... I guess you just like to argue, because that's all you've done. Wasted time, cause I still haven't learned anything...besides now knowing that I have to post code in this forum to get a 'helpful' reply and to avoid getting treated in this offending manner. Quote Link to comment https://forums.phpfreaks.com/topic/157418-javascript-for-ajax/#findComment-833491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.