Jump to content

[SOLVED] quick question (Code request)


ccrevcypsys

Recommended Posts

Hey guys i just have a question.

I need a code to hide the whole data base pull so that it says exampl... then when they hover over that it says the full name.

so heres another example

 

Artist | Song | Album

 

Slipknot | The Heretic A... | Iowa

 

Then on mouse hover it says The Heretic Anthem?

anyone have anything like that or know where i can get it?

Link to comment
Share on other sites

Ok well i took that code and implimented my own code to make it work for my site. But the thing is it isnt working. It posts the first and last name but doesnt put the ...

 

and i know the class is different then most the $view_cat->assign("TXT_ARTIST", $shortTrack); is the echo

<?php
        $trackname = $productResults[$i]['firstName']." ". $productResults[$i]['lastName'];
$shortTrack = (strlen($trackname>10) ?substr($trackname,0,."...":$trackname);
$view_cat->assign("TXT_ARTIST", $shortTrack);
?>
[/code

Link to comment
Share on other sites

Do u know where i can get this java script code?

Try using:

 

$shortTrack = strlen($trackname) > 10 ? substr($trackname,0,."...": $trackname;

 

However, you're going to need to be echoing some javascript along with this too if you want to allow people to hover over the text to show the whole lot.

Link to comment
Share on other sites

Here's an example of how it might work:

 

<script type="text/javascript">
function showall(id,text){
document.getElementById(id).innerHTML=text
}
function showshort(id,text){
document.getElementById(id).innerHTML=text
}
</script>
<span id="test" onmouseover="showall(this.id,'the full text')" onmouseout="showshort(this.id,'the full...')">the full...</span>

 

However, that would simply make everything wider. I guess what you're really after is some sort of tooptip to appear above the text. I know there are lots of these that you can find on the web. I suggest you google.

 

 

Link to comment
Share on other sites

If all you want is some simple popup text (i.e. no formatting) - then you do not need javascript. Just simply use the title attribute. If it will be a link, use the title attribute inside the link tag. If it is just text on the screen that you want the popup on, put the text in a span with the title attribute. Works in IE and FF.

 


<span title="A bird in the hand is worth two in the bush">A bird in the hand is...</span>

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.