JavaScript DHTML/Scriptaculous/In place editor

Материал из Web эксперт
Версия от 10:26, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Demo of the Ajax.InPlaceCollectionEditor.

   <source lang="html4strict">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>

 <title>script.aculo.us Demo</title>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <script src="scriptaculous-js-1.8.2/lib/prototype.js" type="text/javascript"></script>
 <script src="scriptaculous-js-1.8.2/src/scriptaculous.js" type="text/javascript"></script>
 <script src="scriptaculous-js-1.8.2/src/unittest.js" type="text/javascript"></script>
 <style type="text/css" media="screen">
   .inplaceeditor-saving { background: url(wait.gif) bottom right no-repeat; }
 </style>

</head> <body>

script.aculo.us Demo

Demo of the Ajax.InPlaceCollectionEditor.

three

(should autoselect "three")

<script> new Ajax.InPlaceCollectionEditor(

 "tobeedited", "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 collection: ["one","two","three"],
 ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script>

two

(should autoselect "two")

<script> new Ajax.InPlaceCollectionEditor(

 "tobeedited2", "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 collection: [[0,"one"],[1,"two"],[2,"three"]],
  ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script>

three

(should manually select "one")

<script> new Ajax.InPlaceCollectionEditor(

 "tobeedited3", "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 collection: [[0,"one"],[1,"two"],[2,"three"]],
 value: 0,
 ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script>

one

(should manually select "two")

<script> new Ajax.InPlaceCollectionEditor(

 "tobeedited4", "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 collection: ["one","two","three"],
 value: "two",
 ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script> </body> </html>

 </source>
   
  


In place editor: with Ok, Cancel button, links

   <source lang="html4strict">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>

 <title>script.aculo.us Demo</title>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <script src="scriptaculous-js-1.8.2/lib/prototype.js" type="text/javascript"></script>
 <script src="scriptaculous-js-1.8.2/src/scriptaculous.js" type="text/javascript"></script>
 <script src="scriptaculous-js-1.8.2/src/unittest.js" type="text/javascript"></script>
 <style type="text/css" media="screen">
   .inplaceeditor-saving { background: url(wait.gif) bottom right no-repeat; }
 </style>

</head> <body>

script.aculo.us Demo

Demo of the Ajax.InPlaceEditor.

To be edited

<script> new Ajax.InPlaceEditor($("tobeedited"), "_ajax_inplaceeditor_result.html", {

       ajaxOptions: {method: "get"} //override so we can use a static for the result
       });

</script>

To be edited w/ blur

<script> new Ajax.InPlaceEditor($("tobeeditedblur"), "_ajax_inplaceeditor_result.html", {

       submitOnBlur: true, okButton: false, cancelLink: true,
       ajaxOptions: {method: "get"} //override so we can use a static for the result
       });

</script>

To be edited w/ okLink and cancelButton

<script> new Ajax.InPlaceEditor($("tobeeditedoklink"),

 "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 okButton: false, 
 okLink: true,
 cancelButton: true,
 cancelLink: false,
 textBeforeControls: " ---> ",
 textBetweenControls: " | ",
 textAfterControls: " <--- ",
 ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script>

To be edited w/ okLink only

<script> new Ajax.InPlaceEditor($("tobeeditedoklinkonly"),

 "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {
 okButton: false, 
 okLink: true,
 cancelButton: false,
 cancelLink: false,
 textBeforeControls: " ---> ",
 textBetweenControls: " | ",  // will not be used, as one control only
 textAfterControls: " <--- ",
 ajaxOptions: {method: "get"} //override so we can use a static for the result

}); </script>

With external edit control and custom parameter name   <a id="tobeedited2EditControl" href="#">edit</a> <script> new Ajax.InPlaceEditor($("tobeedited2"), "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {

   externalControl: "tobeedited2EditControl",
   paramName: "foobar",
   ajaxOptions: {method: "get"} //override so we can use a static for the result
   });

</script>

<tbody> </tbody>
test <a id="tobeeditedTDEditControl" href="#">edit</a>

<script> new Ajax.InPlaceEditor($("tobeeditedTD"), "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {

   externalControl: "tobeeditedTDEditControl"
   });

</script>

Multi row editor: Lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum lorum ipsum

<script> new Ajax.InPlaceEditor($("tobeedited3"), "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html", {

   rows:5,
   ajaxOptions: {method: "get"} //override so we can use a static for the result
   });

</script>

Loads text from server

<script> new Ajax.InPlaceEditor($("tobeedited4"), "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html",

   {ajaxOptions: {method: "get"}, //override so we can use a static for the result and to load the text
   loadTextURL: "_ajax_inplaceeditor_text.html"
   });

</script>



























































Editor very far down to test scrolling bug

<script> new Ajax.InPlaceEditor($("tobeeditedFarDown"), "scriptaculous-js-1.8.2/test/functional/_ajax_inplaceeditor_result.html"); </script> </body> </html>

 </source>