Jump to content

Color of link title


mithu_sree

Recommended Posts

  • 2 weeks later...
[quote]
How can I change the color and background of the title attribute of the <a> tag and <img> tag?

<a href="somepage.html" title="Go there!!"> click me [/url]
[/quote]

isnt it supposed to be <a href="http://thelink.com"> clickme [u]</a>[/u] ?? ???
Link to comment
Share on other sites

You cannot do this with css but you can use javascript, here is an edited function that I have used.

This may only work in Mozilla, my website disabled IE, so i havnt tested but i will do a quick one.

** EDIT : It does not work in IE sorry. Go to the developers site and I think there is an uglier version that may work for you.

[code]<div id="dhtmltooltip">
    <table id="table" cellspacing="0" cellpadding="0">
    <tr>
      <td class="left"></td>
      <td class="middle" id="displayText"></td>
      <td class="right"></td>
    </tr>
    </table>
  </div>

<script type="text/javascript">

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=10 //Customize x offset of tooltip
var offsetypoint=10 //Customize y offset of tooltip
var enabletip=false

var tipobj=document.getElementById("dhtmltooltip")

function ddrivetip(thetext, thewidth){
if (!thetext)
return false

if (!enabletip) {
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
document.getElementById("displayText").innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=e.pageX;
var curY=e.pageY;

var rightedge=window.innerWidth-e.clientX-offsetxpoint-10
var bottomedge=window.innerHeight-e.clientY-offsetypoint-10

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

if (rightedge-10<tipobj.offsetWidth)
tipobj.style.left=window.innerWidth-tipobj.offsetWidth-20+"px"
//tipobj.style.left=window.pageXOffset+e.clientX-tipobj.style.left+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
tipobj.style.left=curX+offsetxpoint+"px"

if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
enabletip=false
tipobj.style.visibility="hidden";
tipobj.style.left="-1000px";
}

document.onmousemove=positiontip

</script>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.