Forum Moderators: open
I need a copy clipboard script. i get that code from this forum and i use it. Only one thing that if i want to show/hide a div that show "Click Here to copy the code" onmouseover on the particular div. How i can do that? Please help.
i use that code
<html>
<head>
<style type="text/css">
a.code {
display: block;
padding: 1px 0 1px 2px;
width: 200px;
border: 1px solid #ccc;
text-decoration: none;
font-weight: bold;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="Zeroclipboard.js"></script>
<script language="JavaScript">
var clip = null;
function init() {
// Set up a single zeroclipboard object for all elements
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
// Using jQuery, assign a common mouseover function for all elements
$('a.code').mouseover( function() {
// Set the clip text to our innerHTML
clip.setText( this.innerHTML );
// Store the href in a variable inside the object
clip.this_href = this.href;
// Reposition the Flash movie over element,
// or create it if this is the first time
if (clip.div) {
clip.receiveEvent('mouseout', null);
clip.reposition(this);
}
else clip.glue(this);
// Must force these events due to the Flash movie
// moving all over. This ensures that the CSS
// effects are properly updated.
clip.receiveEvent('mouseover', null);
} );
// Add an event handler which opens a new window after text is copied
clip.addEventListener('complete', function(client, text) {
window.open(clip.this_href,'','width=400,height=200');
} );
}
function forie(val)
{
if(navigator.appName == "Microsoft Internet Explorer")
{
alert("You're using the Internet Explorer browser.");
if (window.clipboardData) {
window.clipboardData.setData("Text",val);
}
}
}
function showdiv()
{
document.getElementById("test").style.display='block';
}
function hidediv()
{
document.getElementById("test").style.display='none';
}
</script>
</head>
<body onLoad="init()">
<div><a class="code" href="http://www.google.com" target="_blank" onClick="javascript:forie('CODE1')">CODE1</a><br /><br /></div>
<div><a class="code" href="http://www.yahoo.com" target="_blank" onClick="javascript:forie('CODE222222')">CODE222222</a><br /><br /></div>
<div><a class="code" href="http://www.youtube.com" target="_blank" onClick="javascript:forie('CODE333333333')" >CODE333333333</a><br /><br /></div>
<div><a class="code" href="http://www.ask.com" target="_blank" onClick="javascript:forie('CODE4444444444444')" >CODE4444444444444</a><div id="test3" style="display:none;">Helllooo</div>
</div>
</body>
</html>
i just want to when any user mouse over on CODE1,CODE4444444444444 etc a div will open just bellow the particular div and show "Click Here to copy the code" . How it possible?
<div><a class="code" href="http://www.google.com" target="_blank" onClick="javascript:forie('CODE1')" [b]onmouseover="showdiv();"[/b]>CODE1</a><br /><br /></div>
Post back if this helps, or with more detail on what you are trying to accomplish. I'm sure we'll be able to help. :)