Foros del Web » Programando para Internet » Jquery »

Mi función no funciona bien sino la llamo con un evento (usa sexy.alerts)

Estas en el tema de Mi función no funciona bien sino la llamo con un evento (usa sexy.alerts) en el foro de Jquery en Foros del Web. Mi función no funciona bien sino la llamo con un evento (usa sexy.alerts) Yo desarrollé una función para tener una alerta más agradable más atractiva ...
  #1 (permalink)  
Antiguo 26/07/2013, 12:13
 
Fecha de Ingreso: julio-2013
Mensajes: 9
Antigüedad: 10 años, 9 meses
Puntos: 0
Mi función no funciona bien sino la llamo con un evento (usa sexy.alerts)

Mi función no funciona bien sino la llamo con un evento (usa sexy.alerts)
Yo desarrollé una función para tener una alerta más agradable más atractiva en mi sitio Web. De hecho se llama betteralert Básicamente mi función toma algunas decisiones y llama a sexy.alert, que es una alerta con jQuery que alguien ofrece desde hace varios años. Si yo llamo a betteralert (mi función) desde un evento (como click) todo funciona perfectamente. Pero si no llamo a betteralert desde un evento sino que solamente la llamo, sexy.alert no funciona. No entiendo por qué. Alguien sabe si sexy.alert sólo funciona con eventos?? O qué podrá estar mal?? sexy.alerts tiene problemas conocidos??
Les agradezco cualquier respuesta y comentario. Aquí les dejo el código:
Código HTML:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript" src="sexyalertbox.v1.2.jquery.js"></script> <!--Se llaman las librerías. Funciona bn
<link rel="stylesheet" type="text/css" media="all" href="sexyalertbox.css"/>
<script type="text/javascript">
function betteralert(text, title_outside) //title_outside es un paramétro opciona. Esta es la función mía 
<!doctype html>
<html>
<head>
<meta charset="utf-8">

<!--Se llaman las librerías. Funciona bIEn-->
<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript" src="sexyalertbox.v1.2.jquery.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="sexyalertbox.css"/>

<script type="text/javascript">

function betteralert(text, title_outside) //title_outside is an optional parameter
	{
		text_print="";
		
		if (title_outside == undefined) //If there isn't the title in the parameters, so it uses the default title.		//Este if sólo define qué irá en el título. Ignorarlo para este caso
		{
			var title="Thanks for use Wagerplus.com";
		}
		else
		{
			var title=title_outside;
		}
		text_print="<h1>"+title+"</h1><em></em><br/><p> &nbsp;&nbsp;"+text+"</p>'"; //The text will be in the alert
		try
			{
				if(!Sexy.alert(text_print))	//Ojo q aquí se llama a la función sexy.alert				{
					return false;					
				}
				else
				{
					alert(text);
					return true;
				}
			}
		catch(change_type_alert)
			{
				alert(text+" Entro al catch");
			}
		title_outside=undefined;
	}
</script>

<title>Prueba - Alerta que se desliza</title>
</head>

<body>

<p>

    </br> <!-------------------------------------------->		
    <a href="#" onclick="betteralert('This is the text','This is the title');"> <!----------call to the function-------------->
    	Show alert																<!-------------------------------------------->	
    </a>
    
</p>


<!--
------------------------------------------------------------------->	
<!----------------------------------------------------------------->	
<!-------I need the function work as you can see bellow,------------>
<!-------I have some functions working as I need work betteralert.->
<!-------It work well if I use jalert and not sexy.alert.---------->	
<!-------but I need sexy.alert or something like that, I mean,----->
<!-------something really beautiful--------------------------------->
<!----------------------------------------------------------------->	

<script type="text/javascript">

betteralert("Thanks for use our website <p>&nbsp;&nbsp;This is the function betteralert</p>");

</script>
 -->
</body>
</html> 

Última edición por zerokilled; 26/07/2013 a las 12:28 Razón: bbcode

Etiquetas: javascript, sexy
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:31.