Results 1 to 2 of 2
Sep 20, 2008, 14:37 #1
- Join Date
- Sep 2008
- 0 Post(s)
- 0 Thread(s)
Tweak tooltip code to change background color/image on persons birthday month
please remove post thanks.
Last edited by AlongSide; Sep 23, 2008 at 17:29.
Sep 20, 2008, 20:48 #2
Just a quick glance through this code - it looks like very old style DHTML code.... Did you down load this from some "scripts" site? The section at the top:
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "#000000";
var tipBgColor= "#DDECFF";
var tipBorderColor= "#000080";
var tipBorderWidth= 3;
var tipBorderStyle= "ridge";
var tipPadding= 4;
Seems to be setting up the variables for the styling of the tooltip, this then gets applied during the initTip function. The reason this seems "old school" is that it would be better to put this stuff in CSS... Also this has a strange use of document.write() at the end of the code to emit the <div> for the tool tip - which should be done with DOM manipulation instead.
In any case - you could create a wrapper function above this initialization code - and if it is the users birthday month (not sure how you have that info accessible in your code)... then change the color. Would be a simple if-then conditional. You might run into problems with this particular script - because of the use of document.write(). It is requiring this script to execute inline as the page loads - and not on page load - otherwise the document.write() would blow away your page HTML.
Again there may be better ways to do the tip using something modern like jQuery or another library - or at a minimum with DOM techniques.
If you give specifics of how you know the birthday month in your application, then it will be easier to suggest how to write the conditional.- PM me to start building fair link exchanges automatically -
LnkPro.com - Link Exchanges for Professionals