Webmaster

Rozrywka

Zwierz?ta

Motoryzacja

Transport, ci???arowe

O ci???ar??wkach i transporcie

Sport

Koszyk??wka

Basketball - newsy

Fotografia

Komputery

O serwisie

Serwis ten jest agregatorem RSS, który magazynuje zebrane informacje tak, aby można było do nich swobodnie później wrócić. Wszystkie treści pochodzą z kanałów RSS i są własnością twórców serwisów, które je udostępniają.
Tytuł każdego artykułu jest odnośnikiem do strony, z której dana treść pochodzi.
Baza zawiera 191428 akrtykułów.

Polecamy

Katalog Sklepów internetowych
Kosmetyki
Oferty Wakacje
Kashub
Dzwonki polifoniczne
Tapety na telefon
Wygaszacze na komórkę
Sztandary
Sztandar
Sztandary szkolne

If you are looking to display a comment box for your website, following a simple code to do it.


In form action, put your html page. You can change the color of the background, to do it just change the value in background-color. To change the size of the box just change the value in width and height. To change the font, just change the value in font-family, to change the color of the font, in color and his size in font.
Last thing, this is just a script to display a comment box with a submit button but you will not be able to add any entry, like the title said, it is just to display a comment box for your website, just a trick !!!

[178823]

If you are using Expression Web for your site in ASP.NET, may be you encounter with one of those problems, it doesnt work with custom controls in the toolbox or custom controls dont display and you get an error like unknown server tag ajaxtoolkit error message !!!
To solve this issue, you have to install the assembly in the GAC by typing this following command in the NET console : gacutil –i nom_assembly.dll
After go to the ajaxcontroltoolkit properties to get the version and the public key token and in the aspx pages, you have to make a reference of both information by using the full name of the tool like :
Assembly=”AjaxControlToolkit, Version=XXXX, Culture=neutral, PublicKeyToken=XXXX”
Namespace=”AjaxControlToolkit”
TagPrefix=”ajaxToolkit”
And now it should work :)

[174663]

I think there are a lot of people like you work a lot in code instead of design mode, for those in my situation, following a little tip to hide our big div that we create.
It will allow us to see the code a little clear and more easy to work, and of course, it can display the div again if you wish, here the code to add between .

function hide(link){
var objet = document.getElementById(’popup’); // entre les deux ‘ tu mes le nom du div que tu veux faire apparaître !
if(objet.style.display == “none” || !objet.style.display){
objet.innerHTML = “Ici le text que tu veux faire apparaître !”;
objet.style.display = “block”;
objet.style.overflow = “hidden”;
link.innerHTML = “-”;
var hFinal = 200; //Hauteur finale (la hauteur une fois que ça aura fini de déplier !)
var hActuel = 0; //Hauteur initiale (la hauteur dès le début !)
var timer;
var fct = function () {
hActuel += 20; //Augmente la hauteur de 20px (tu peux modifier) tous les 40ms !

objet.style.height = hActuel + ‘px’;

if( hActuel > hFinal)
{
clearInterval(timer); //Arrête le timer
objet.style.overflow = ‘inherit’;
} };
fct();
timer = setInterval(fct,40); //Toute les 40 ms
}else if(objet.style.display == “block”){
var hFinal = 0; //Hauteur finale (la hauteur une fois que ça aura fini de déplier !)
var hActuel = 200; //Hauteur initiale (la hauteur dès le début !)
var timer;
var fct = function () {
hActuel -= 20; //Augmente la hauteur de -20px (tu peux modifier) tous les 40ms !
objet.style.height = hActuel + ‘px’;
if( hActuel < hFinal) {
clearInterval(timer); //Arrête le timer
objet.style.overflow = ‘inherit’;
objet.style.display = “none”;
} };
fct();
timer = setInterval(fct,40); //Toute les 40 ms
link.innerHTML = “+”;

} }

Following the code to be addedd between

[+]

Over there my friend !!!

Hope it will be useful for everybody

[173758]

Secure your request is very important since it will prevent someone to steal or to get in your datas. Following a way to do it.
You have to be able to generate a secure key from the server and after to affect the key the following code : $_SESSION[’Env_UserSession’][’AjaxKey’] = $key_sec
From the customer side, the key should be available via javascript and it can be a source of an hidden string. During the ajax request, get back the key and to transmit it to the ajax parameters. When the request is launched, you have to control from the server that the key exists and to verify it with the one saved in the session (this one should be verify before to generate the ajax content to the customer).
When you have to control the server, you have to verify very well POST or GET exists because if it is empty, it can be someone try to steal the content. If all are ok, you can deliver the content without any danger.

[165067]

I will propose 3 tips about ajax that i used.

- Add a slideshow in your web site. I propose you to try SmoothSlideShow.SmoothSlideShow is very easy to use, you can install it for free and it is very cool for pictures.

- Debugging drafts with Firebug. Firebug is a plugin for Firefox on which you can edit, debug, and monitor CSS, HTML, AJAX and JavaScript live in any web page.

- Creating easily some frameworks with those 4 tools. Mootools allows you to create some effects easily. Yahoo UI library allows you to create a thousand of interfaces and effects. Dojo allows you to create widgets, graphs and etc. OpenRico allows you to create animations, ajax, drag and drop…

I hope you will have fun with those tools like me.

[159598]

Test

[159597]

From the website www.jquery.com, download the library “jquery” and following the script to name a file using this library : $. ajax({type: “post”, url: “namefile.php”, data: “name=Henry&location=NY”, success: function(msg){alert(msg).

[158110]

It is very difficult to create a form, at least for people who have no knowledge about programming. There is a web site which proposes for those people to create a form in a very easy way.

You just have to go to this site http://www.jotform.com , create an account (it s free totally) and after log in just choose one of the assistants to create your own form. You can configure totally your form and the application is very simple and easy to use.

The bad point is that the generated code is not very clean for some form but what is the most important point, that we get the good result.

[154741]

Its difficult to claim perfection in anything, even Ajax. While Ajax has enhanced the web experience for many users, and there is not shortage of people constantly praising its merits, it is perhaps no longer the newest standard. Sure, it allows relatively easy integration of interactive elements in web pages, but is it really all that powerful and versatile as is often claimed?

There are three major standards for the development of Rich Internet Applications: Ajax, Java, and Flash. None of these are perfect solutions, but each has its own advantages over the others.

This is where the choice comes in. Ajax is at its strongest for such applications as information submission, but weaker when applied as a true asynchronus system.

On the other hand, Ajax is probably the most versatile of the options available. While not always the most efficient, it can get the job done. Many of its disadvantages can be blamed on web browsers not following standards and not being optimized for the desired degree of interactivity.

[126265]

AJAX stands for Asynchronous JavaScript And XML. Any server side technology that supports JavaScript also supports AJAX. AJAX is a browser technology, and is therefore independent of web server platforms.

In this article we will learn about what AJAX is, how it works, and how can we use AJAX with PHP. Please remember, AJAX is not a programming language, so you don???t have to learn any new technology. AJAX can be implemented by using existing standards (JavaScript and XML) in a different way.

If we are using PHP or any server side technology and need to extract data from storage on a server (eg a database or a file), we will have to make an HTTP request (either POST or GET) to get the data. Once the data is received the the web page will need to be reloaded to show the data. Using AJAX technology we can request and receive the data from server in background and then display it on the page without a reload. AJAX uses HTTP requests for this. With AJAX, JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object (XML over HTTP). With an HTTP request, a web page can make a request to, and get a response from a web server without reloading the page.
The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7. But the creation of XMLHttpRequest object is different in Internet Explorer than the other browsers. I will discuss this later. To use AJAX to request a data from the server we need to do the following.

1. Create an XMLHttpRequest object.
2. Then using this object, request data from the server.
3. JavaScript will then monitor for the changing of state of the request.
4. If the response is successful, then the content from the data store requested will be returned as response (response can be in the form of a String or XML).
5. Use the response in your web page.

1. Create an XMLHttpRequest object

JavaScript has a built-in XMLHttpRequest object. You can use that for Firefox, Safari, and Opera. For Internet Explorer use the ActiveXObject, there is also a difference between IE 5.0 and IE 6.0+ in how to create the object. The following codes creates an XMLHttpRequest for all browsers:

var req;

if(window.XMLHttpRequest){
//For Firefox, Safari, Opera
req = new XMLHttpRequest();
}
else if(window.ActiveXObject){
//For IE 5
req = new ActiveXObject(”Microsoft.XMLHTTP”);
} else if(window.ActiveXObject){
//For IE 6+
req = new ActiveXObject(”Msxml2.XMLHTTP”);
}
else{
//Error for an old browser
alert(’Your browser is not IE 5 or higher, or Firefox or Safari or Opera’);
}

Here, first we are using the built-in JavaScript function XMLHttpRequest() for creating an XMLHttpRequest for Firefox, Safari and Opera. If the browser does support window.ActiveXObject, then it is Internet Explorer. For IE versions 5.0+, use new ActiveXObject(”Microsoft.XMLHTTP”) and for IE 6.0+ use new ActiveXObject(”Msxml2.XMLHTTP”). If the browser does not support the built-in JavaScript function XMLHttpRequest() or ActiveXObject, then it does not support AJAX. You can also use JavaScript try-catch blocks for the same output.

var req;
try
{
// Firefox, Opera, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(’Your browser is not IE 5 or higher, or Firefox or Safari or Opera’);
}
}
}

In JavaScript, if statements within a try section fail, then the execution resumes from the corresponding catch block. Here first we are trying to get create a XMLHttpRequest using the built-in function, and if it fails then we will try using ActiveXObject(”Msxml2.XMLHTTP”), and if it fails also we will try ActiveXObject(”Microsoft.XMLHTTP”). If all these fail, then we will alert the user that his/her browser does not support AJAX.

2. Request for a web page

After creating the XMLHttpRequest we now need to send the web request using the open method. We also need to specify the HttpRequest method, GET or POST. Use the following code to send the request.

req.open(???GET???,???somedata.php???);
req.send(null);

Here, req is the XMLHttpRequest object. It will request to the server for somedata.php using GET method. The open function also has a third parameter, an optional boolean parameter. You should set that to true :

req.open(???GET???,???somedata.php???,true);
req.send(null);

Both of the above is correct.

3. Monitor for the response of the request

You will need to monitor for the state of the request. For doing this you can assign a function to req.onreadystatechange (Here, req is the XMLHttpRequest object), like below.

req.onreadystatechange=function()
{
if(req.readyState==4 && req.status == 200)
{
var resp = req.responseText;
}
}

Or like this,

req.onreadystatechange = handleResponse;

function handleResponse(){
if(req.readyState == 4 && req.status == 200){
//returned text from the PHP script
var response = req.responseText;
}
}

The readyState property holds the status of the server’s response. Each time the readyState changes, the onreadystatechange function will be executed. Here are the possible values for the readyState property:
State Description
0 The request is not initialized
1 The request has been set up
2 The request has been sent
3 The request is in process
4 The request is complete

And status is the status of the HTTP Request, like 500 Internal Server Error, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found etc. 200 means no error.

4. Get the response

The response will be as string or as XML. The data sent back from the server can be retrieved with the responseText property as string. Use responseXML for getting the response as XML.

5. Use the response on your web page

You can use the response you got from the XMLHttpRequest in your web page/application. You can either set a value of a text field or use the returned HTML from the web request as innerHTML for a

tag or tag (See below for the implementation of this)

Using AJAX with PHP

I usually place all the AJAX related functions in one JavaScript (ajax.js), and later add the JavaScript in my PHP pages. My ajax.js looks like below.

function createRequestObject(){

var req;

if(window.XMLHttpRequest){
//For Firefox, Safari, Opera
req = new XMLHttpRequest();
}
else if(window.ActiveXObject){
//For IE 5+
req = new ActiveXObject(”Microsoft.XMLHTTP”);
}
else{
//Error for an old browser
alert(’Your browser is not IE 5 or higher, or Firefox or Safari or Opera’);
}

return req;
}

//Make the XMLHttpRequest Object
var http = createRequestObject();

function sendRequest(method, url){
if(method == ‘get’ || method == ‘GET’){
http.open(method,url,true);
http.onreadystatechange = handleResponse;
http.send(null);
}
}

function handleResponse(){
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;
if(response){
document.getElementById(”ajax_res”).innerHTML = response;
}
}
}

Now I add a tag in my PHP pages like following to access the JavaScript functions.

Then I create a function called sendReq() as shown above for preparing the URL to the PHP page to get some data from the database. If you look into the ajax.js, you will see that I???m assigning the output of the PHP page to a

tags innerHTML. My div tag has the

After calling the sendReq function with a value of ???success???, it will connect to the server for sending a request to the URL get_lcm.php?status=success, then get the data from the database using the value ???success???, and set the innerHTML attribute of the div tag whose id is ???ajax_res??? according to the response. Initially my div tag shows an image, but after AJAX responds successfully this image will be replaced with the response. You can also get the response as the value of an input text.

My get_lcm.php looks like this.

<?php
include_once(”create_table.php”);

if(!empty($status)){
echo “Search Result for Status: “.$status.”

“;

$ct = new createtable(”select * from lcm where state=$status”);

$ct->table_viewer();
}
?>

I used one of my PHP classes ???create_table.php??? for creating a table from SQL queries. ???create_table.php??? has a function, table_viewer(), to print the SQL output as a HTML table. I will discuss about this class and some other data abstraction classes I used in some later articles, if necessary.

I had the following HTML code for calling the AJAX function using the sendReq() as described earlier.

ACTIVE

If a user clicks the above hyperlink, then the JavaScript function sendReq is invoked using the value of status equal to 1. After that the webpage with URL get_lcm.php?status=1 will be invoked. This PHP will get the information from database and shows the result as table. This result will then be displayed within the

tag.

Using AJAX from PHP is very easy as described here. All you need is the JavaScript functions for sending the XMLHttpRequest and then handle the Http Response. It will simplify development is you place all your AJAX related code in a single JavaScript file and reference it from anywhere you need AJAX.

There is another way of getting the same result from PHP without using the XMLHttpRequest object. But I personally do not like the concept, because it is missing one of the main ingredients of Asynchronous JavaScript And XML (AJAX), XML. This concept is good for the old browsers with no supports for XMLHttpRequest object, but as all the newer versions are supporting XMLHttpRequest object you can use AJAX for the common browsers.

[119045]
Strony: [01] [02] [03] [04] [05] [06]