Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/10/2008, 08:35
Zptweb
 
Fecha de Ingreso: mayo-2007
Mensajes: 68
Antigüedad: 17 años
Puntos: 0
Mensaje Respuesta: Refrescar div pero sin url

Hola, el contenido del div es este:

Código:
<div onclick="expandcontent('sc1')" style="z-index: 4;font-family: Arial;font-size: 14px;font-weight: bold;text-align: center;background-image: url(http://www.addictools.com/images/fav.gif);background-repeat: no-repeat; left: 0px; top: 0px;cursor: hand; cursor:pointer;position: absolute;margin-top: 60px;width: 100px; height: 29px;"><div style="margin-top: 4px;">Favorites</div></div>
<div  style="font-family: Arial;font-size: 13px;left: 0px; top: 0px;position: absolute;margin-top: 86px;width: 150px;border-color: #3da40a;
border-style: solid;
border-width: 1px;background-color: #efefef;" id="sc1" class="switchcontent"><?php
if( isset( $_COOKIE['ako'] ) ) {
        echo "<div style=\"margin-top: 5px;\"><img src=\"http://utility-tools.addictools.com/cog.png\" title=\"This favorite is a utility tool\" alt=\"This favorite is a utility tool\" />   <a href=\"http://scrollbar-creator.addictools.com/\">$_COOKIE[ako]</a> <a href=\"#\" onclick=\"sco()\"><img style=\"margin-left: 9px;\" src=\"http://www.addictools.com/images/close.png\" title=\"Delete\" alt=\"Delete\" /></a></div>";
        } else {
       echo "";
       }
      if( isset( $_COOKIE['pop'] ) ) {
        echo " <a href=\"http://popups-creator.addictools.com\"><div style=\"margin-top: 5px;margin-bottom: 5px;\"><img src=\"http://utility-tools.addictools.com/cog.png\" title=\"This favorite is a utility tool\" alt=\"This favorite is a utility tool\" />  $_COOKIE[pop]</a> <a href=\"#\" onclick=\"Delete_Cookie('pop', '/', 'addictools.com')
 alert('The favorite called Popups creator has been removed');\"><img style=\"margin-left: 17px;\" src=\"http://www.addictools.com/images/close.png\" title=\"Delete\" alt=\"Delete\" /></a></div>";
        } else {
       echo "";
       }
          if( isset( $_COOKIE['byte'] ) ) {
        echo "<div style=\"margin-top: 5px;margin-bottom: 5px;\"><img src=\"http://utility-tools.addictools.com/cog.png\" title=\"This favorite is a utility tool\" alt=\"This favorite is a utility tool\" />   <a href=\"http://byte-converter.addictools.com\">$_COOKIE[byte]</a> <a href=\"#\" onclick=\"Delete_Cookie('byte', '/', 'addictools.com')
 alert('The favorite called Byte converter has been removed');\"><img style=\"margin-left: 21px;\" src=\"http://www.addictools.com/images/close.png\" title=\"Delete\" alt=\"Delete\" /></a></div>";
        } else {
       echo "";
       }
          if( isset( $_COOKIE['byte'] ) OR  isset( $_COOKIE['pop'] ) OR isset( $_COOKIE['ako'] )) {

        echo "<hr><a href=\"#\" onclick=\"deleteall()\"><div style=\"cursor: hand; cursor:pointer;text-align: center;margin-bottom: 5px;\">Delete all</div></a>";
        }
   if( !isset( $_COOKIE['byte'] ) &&  !isset( $_COOKIE['pop'] ) && !isset( $_COOKIE['ako'] )) {
   
   echo "<div style=\"margin-top: 5px;margin-bottom: 5px;\">You don't have favorites.</div>";
}        
?></div>
</div>
Y claro, este contenido, llama a un trozo de archivo javascript, este:


Código:
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

// this fixes an issue with the old method, ambiguous values 
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}	
function primerizo()
{
Set_Cookie( 'ako', 'Scrollbar Creator', '3000', '/', 'addictools.com', '' )
if ( Get_Cookie( 'ako' ) ) alert('You just added the link to the menu of favorites. Now you will have a link in the menu on the left side, where you can watch your favorite links, quickly.');
     document.getElementById("sc1").innerHTML = "Refresh the page for see the new favorites."
}
function pop()
{
Set_Cookie( 'pop', 'Popups Creator', '3000', '/', 'addictools.com', '' )
if ( Get_Cookie( 'pop' ) ) alert('You just added the link to the menu of favorites. Now you will have a link in the menu on the left side, where you can watch your favorite links, quickly.');
     document.getElementById("sc1").innerHTML = "Refresh the page for see the new favorites."

}
function byte()
{
Set_Cookie( 'byte', 'Byte Converter', '3000', '/', 'addictools.com', '' )
if ( Get_Cookie( 'byte' ) ) alert('You just added the link to the menu of favorites. Now you will have a link in the menu on the left side, where you can watch your favorite links, quickly.');
}

function sco()
{

Delete_Cookie('ako', '/', 'addictools.com')
 alert('The favorites are been removed');
      document.getElementById("sc1").innerHTML = "<div style=\"margin-top: 5px;margin-bottom: 5px;\">Refresh the page for see the changes.</div>"

 }
function deleteall()
{

if (confirm('Are you sure to delete ALL the favorites?')) {
Delete_Cookie('ako', '/', 'addictools.com')

Delete_Cookie('pop', '/', 'addictools.com')


Delete_Cookie('byte', '/', 'addictools.com')
 alert('All the favorites are been removed');
       document.getElementById("sc1").innerHTML = "<div style=\"margin-top: 5px;margin-bottom: 5px;\">Refresh the page for see the changes.</div>"
 } else {
 alert('Ok, the favorites have not been eliminated');

}
}

// remember, these are the possible parameters for Set_Cookie:
// name, value, expires, path, domain, secure
// and these are the parameters for Delete_Cookie:
// name, path, domain
// make sure you use the same parameters in Set and Delete Cookie.
Entonces, como lo hago?