[Proto-Scripty] Re: Help destroying many events on tr mouseenter and mouseleave

2011-07-10 Thread Douglas
I've been in a similar situation, where I had a list of search results which 
were updated on every key press (but at most once every 100ms), and I wanted 
each row in the results table to have mouse-hover effects. My solution was 
to attach an event handler only to the table, and then wait until the on 
mouse move event to work out which element the mouse was over by using 
Event.element(event). This means that you don't need to attach or detach any 
event handlers, since there is always just the one on the table itself.

Douglas

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/qqWMFOv01RoJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: click one checkbox will submit only one checkbox value (not the whole form) immediately

2010-03-11 Thread Douglas
Well, this has nothing to do with prototype, but you might use
Prototype's Ajax.Request[1] to send only the data from the checked
input (as follow):

e.g.:
form name=myform method=post
input type=checkbox name=choice value=1 onclick=myMubmit(this);
input type=checkbox name=choice value=2 onclick=myMubmit(this);
input type=checkbox name=choice value=3 onclick=myMubmit(this);
/form

function myMubmit(input) {
  new Ajax.Request(url, {
method: 'post',
parameters: input.name +'='+input.value,
onSuccess: function(r) {
  // show the result or do something wild
}
  });
}

You can also use Prototype's Event.observe[2] to check the click event
on each checkbox.

[1] http://api.prototypejs.org/ajax/ajax/request.html
[2] http://api.prototypejs.org/dom/event.html#observe-class_method

Cheers,

On Thu, Mar 11, 2010 at 12:50 PM, albert kao albertk...@gmail.com wrote:
 What is the function submitjustthisone() look like?

 On Feb 23, 9:54 pm, Al C al.caug...@gmail.com wrote:
 Albert - change the onclick to point to a javascript
 e.g.,
  input type=checkbox name=choicevalue=1
 onclick=submitjustthisone();

 Of course, youwillalso need to write this function
 script
 function submitjustthisone(){
 //do the stuff you need to do}

 /script

 On Feb 23, 4:58 pm, albert kao albertk...@gmail.com wrote:



  My JSP web page has many checkboxes.
  What is web page source code look like when clickingonecheckboxwill
 submitonlyonecheckboxvalue(not the whole form) immediately?
  i.e. togglingonecheckboxwillsend the info thatonlythatcheckbox
  is toggled.
  This does not work because clickingonecheckboxwillsend the whole
  page
  form name=myform method=post
  input type=checkbox name=choicevalue=1 onclick=submit();
  input type=checkbox name=choicevalue=2 onclick=submit();
  input type=checkbox name=choicevalue=3 onclick=submit();
  ...

 --
 You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To post to this group, send email to prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/prototype-scriptaculous?hl=en.





-- 
D. G. Rodrigues
Consultoria e Auditoria em Desenvolvimento de Softwares

Believe nothing, no matter where you read it or who said it, unless it
agrees with your own reason and your own common sense.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Observing a checkbox

2009-08-13 Thread Douglas

checked === true is wrong you should check for ('checked' ==
$(input).checked || true == $(input).checked)

ps: untested

On Thu, Aug 13, 2009 at 10:53 AM, Jeztahwebmas...@thecarmarketplace.com wrote:

 What is the correct Cross browser way to observe a checkbox being
 checked or not

 I am using

 $('hidenonlive').observe('change',function() {

                                if($('hidenonlive').checked!==true) {
                                        alert('Showing');

                                } else {
                                        $$('.dead-vacancy').invoke('hide');

                                }

                        });

 But it doesnt seem to want to work in IE8 and it doesnt throw an
 error SHoudl i just use click instead?

 Thanks in advance

 ALex
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: get controls array

2009-07-23 Thread Douglas

I'd use classes instead

input type=text name=opt[0][] class=text test /br /
input type=text name=opt[0][] class=text test /br /
input type=text name=opt[0][] class=text test /br /
input type=text name=opt[0][] class=text test /br /
input type=text name=opt[1][] class=text test /br /
input type=text name=opt[1][] class=text test /br /
input type=text name=opt[2][] class=text test /br /
input type=text name=opt[2][] class=text test /br /

script type=text/javascript
//![CDATA[
alert($$('input.test').length);
//]]
/script

The '$$' reference: http://www.prototypejs.org/api/utility/dollar-dollar

On Thu, Jul 23, 2009 at 6:50 PM, diegoturriagadiegoturri...@gmail.com wrote:

 I have something like that:

 tr
  tdPEPE/td
  tdinput ... name=opt[0][]input ... name=opt[0][] ...
 input ... name=opt[0][]/td
  tdselect ... name=selA[].../select/td
  tdselect ... name=selB[].../select/td
 /tr
 tr
  tdJUAN/td
  tdinput ... name=opt[1][]input ... name=opt[1]
 []...input ... name=opt[1][]/td
  tdselect ... name=selA[].../select/td
  tdselect ... name=selB[].../select/td
 /tr
 ...
 tr
  tdTITO/td
  tdinput ... name=opt[n-1][]input ... name=opt[n-1][] ...
 input ... name=opt[n-1][]/td
  tdselect ... name=selA[].../select/td
  tdselect ... name=selB[].../select/td
 /tr

 I want to get the array opt[x] using prototype but $('opt[x]') give me
 only the first instance.

 I need something like getElementsByName but using prototype :)

 Sorry for my english...
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: get controls array

2009-07-23 Thread Douglas

Did you read the given references?

On Thu, Jul 23, 2009 at 9:02 PM, diegoturriagadiegoturri...@gmail.com wrote:

 Well... first that all thanks for your reply!

 I'm trying to use a multidemensional javascript array... various
 arrays of input controls of type checkbox

 I have 10 controls with name myarray[1][]
 other 10 controls with name myarray[2][]
 other 10 controls with name myarray[3][]
 ...
 other 10 controls with name myarray[n][]

 And I need get al controls named iqual in an array var... something
 like:

 var aux = document.getElemntsByName('myarray[1][]`);

 but using prototype sintax... :)


 On Jul 23, 7:04 pm, Matt Foster mattfoste...@gmail.com wrote:
 Hey Diego,

       I'd suggest learning CSS, in particular CSS Selectors.  Second
 read up on prototype, you were a dollar sign away from almost having
 it.

 In your case, the name is too inconsistent, you could have almost
 gotten away with $$(input[name~=opt) but alas there is no space
 after it so it fails.

 As an alternative, looking at your code you just do... $$(input
 [type=text]) or if your collection requisites are more specific, add
 a class to the elements you want to collect and then simply $
 (.myClass)

 --

 http://positionabsolute.net

 On Jul 23, 5:50 pm, diegoturriaga diegoturri...@gmail.com wrote:



  I have something like that:

  tr
    tdPEPE/td
    tdinput ... name=opt[0][]input ... name=opt[0][] ...
  input ... name=opt[0][]/td
    tdselect ... name=selA[].../select/td
    tdselect ... name=selB[].../select/td
  /tr
  tr
    tdJUAN/td
    tdinput ... name=opt[1][]input ... name=opt[1]
  []...input ... name=opt[1][]/td
    tdselect ... name=selA[].../select/td
    tdselect ... name=selB[].../select/td
  /tr
  ...
  tr
    tdTITO/td
    tdinput ... name=opt[n-1][]input ... name=opt[n-1][] ...
  input ... name=opt[n-1][]/td
    tdselect ... name=selA[].../select/td
    tdselect ... name=selB[].../select/td
  /tr

  I want to get the array opt[x] using prototype but $('opt[x]') give me
  only the first instance.

  I need something like getElementsByName but using prototype :)

  Sorry for my english...- Hide quoted text -

 - Show quoted text -
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Slider doesn't work anymore?

2009-07-16 Thread Douglas

Or, you can load the js files after you html  body is loaded/parsed.
It's a good practice (IMO).


html xml:lang=en lang=en xmlns=http://www.w3.org/1999/xhtml;
  head
titleMy testing page/title
  /head
  body
div
  !-- all stuff goes here. --
/div

script src=prototype.js type=text/javascript/script
script type=text/javascript src=script.js/script
  /body
/html


On Thu, Jul 16, 2009 at 1:54 PM, ColinFinecolin.f...@pace.com wrote:



 On Jul 16, 1:22 am, bambell...@hotmail.com bambell...@hotmail.com
 wrote:
 I've made a quick search on Google and realised it's because the
 sliders are being created before the HTML elements are initialised (as
 script.js loads in the header).
 I used a setTimeout and it now works fine! Thanks anyways!

 A *much* better approach is to use an event, and Prototype provides
 one specially for you:

 document.observe('dom:loaded', function () {
  // Any code that depends on the DOM being completely loaded
 })
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax response encoding type changing depending on windows (UTF-8) vs unix (ISO-8859-1)

2009-07-15 Thread Douglas

Prototype has _nothing_ to do with the response code.
Your backend is sending the wrong encoding. Problably, you have not
set the correct send headers.

Are you using a PHP backend? If yes, maybe your local php.ini have
default_charset set to utf-8 and the unix one has not, by default, php
uses iso-8859-1.

Try adding this line to you response:
header('content-type:text/plain; charset=utf-8'); // of course, the
content-type you are expecting
or use [1]utf8_encode(CONTENT) before send the response.

[1] http://www.php.net/utf8-encode

~ Cheers

On Wed, Jul 15, 2009 at 1:00 PM, huskyvictor.at.rog...@gmail.com wrote:

 hihi all,

 i am using Ajax.request() function to call and return results on a web
 page and i noticed that depending on where the server is deployed, the
 encoding of the response changes.

 if i am running the code locally on my windows machine, the Ajax
 response encoding is UTF-8.  but when deployed to a unix server, the
 Ajax response encoding is ISO-8859-1.

 the side-effect is that the response contains unreadable characters
 because it's in the wrong encoding (should be UTF-8, but it's
 ISO-8859-1)

 does anyone know why this happens and how to fix this?

 thanks in advance!
 -h

 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: process further

2009-07-08 Thread Douglas

Hello,
all you have to do (I guess) is set a callback to onComplete.
Something as follow:

// onComplete callback's call
function processJsonPart (myCoolVar)
{
// do something with your returned JSON
return myCoolVarEvaluatedOrValidatedOrAnythingYouWant;
}

// here we call Ajax.request
function clickButtonExample()
{
new Ajax.Request(url, {
onComplete: function(r)
{
var json = r.responseText.evalJSON(true);
$('name').value = foo(json.name);
}
}
}

PS: untested functions.

On Wed, Jul 8, 2009 at 11:37 PM, chrysanthe mchrysant...@gmail.com wrote:
 Hi David
 Thanks, but I think I one step further.  I am assuming an Ajax.request() has
 happened, returned and what I am looking at to understand further is syntax
 like this:
 $('fullName').value = json.fullName;
 for an returned parameter fullName and an html element ID of fullName. I am
 wondering, can I do
 $('fullName').value =processMe( json.fullName);
 which I know the obvious is try it.  I will, just trying to get an heads
 up.  I will report back.  Also I am assuming that prototpye is processing
 that nomenclature $('fullName') segment and just doing a
 document.getElementById.  Any insight appreciated.

 On Wed, Jul 8, 2009 at 12:25 PM, David Behler d.beh...@gmail.com wrote:

 I guess you would have to use Ajax.Request to process the returned
 value before updating the designated element.

 But I'm beginner and could be wrong here.



 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: process further

2009-07-08 Thread Douglas

oops!

'foo' should be 'processJsonPart'

On Thu, Jul 9, 2009 at 1:38 AM, Douglasdouglas.gont...@gmail.com wrote:
 Hello,
 all you have to do (I guess) is set a callback to onComplete.
 Something as follow:

 // onComplete callback's call
 function processJsonPart (myCoolVar)
 {
    // do something with your returned JSON
    return myCoolVarEvaluatedOrValidatedOrAnythingYouWant;
 }

 // here we call Ajax.request
 function clickButtonExample()
 {
    new Ajax.Request(url, {
        onComplete: function(r)
        {
            var json = r.responseText.evalJSON(true);
            $('name').value = foo(json.name);
        }
    }
 }

 PS: untested functions.

 On Wed, Jul 8, 2009 at 11:37 PM, chrysanthe mchrysant...@gmail.com wrote:
 Hi David
 Thanks, but I think I one step further.  I am assuming an Ajax.request() has
 happened, returned and what I am looking at to understand further is syntax
 like this:
 $('fullName').value = json.fullName;
 for an returned parameter fullName and an html element ID of fullName. I am
 wondering, can I do
 $('fullName').value =processMe( json.fullName);
 which I know the obvious is try it.  I will, just trying to get an heads
 up.  I will report back.  Also I am assuming that prototpye is processing
 that nomenclature $('fullName') segment and just doing a
 document.getElementById.  Any insight appreciated.

 On Wed, Jul 8, 2009 at 12:25 PM, David Behler d.beh...@gmail.com wrote:

 I guess you would have to use Ajax.Request to process the returned
 value before updating the designated element.

 But I'm beginner and could be wrong here.



 




 --
 Believe nothing, no matter where you read it, or who said it, no
 matter if I have said it, unless it agrees with your own reason and
 your own common sense.




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Clarification on PUT method in Ajax.Request

2009-06-17 Thread P. Douglas Reeder

The documentation on Ajax.Request, for the method option, says:

method  'post'  The HTTP method to use for the request. The 
other
widespread possibility is 'get'. As a Ruby On Rails special, Prototype
also reacts to other verbs (such as 'put' and 'delete' by actually
using 'post' and putting an extra '_method' parameter with the
originally requested method in there.

Do I understand this to mean that Prototype is incapable of issuing a
true HTTP PUT request, that to issue one, I must deal with the raw XHR
object?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: JSON and Ajax.Updater

2009-06-03 Thread Douglas
On Wed, Jun 3, 2009 at 2:31 PM, Celso cels...@gmail.com wrote:

 var parameters = { ID : 17, Name : 'hello' };

                new Ajax.Updater(
                                td.id
                                ,'../adicionar'
                                ,{asynchronous:true
                                        ,parameters

parameters is mispelled :/ you should use parameters:
'string'|{object} instead. Removing this line it might work

                                        ,evalScripts:true
                                        ,onComplete:function(request, json) 
 {Effect.Pulsate(td.id);}
                                        ,requestHeaders:['X-Update', td.id]
                                        }
                                );

 Does not works :(
 Why?

 Thanks,
 Celso.
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Adding properties to native objects

2009-05-21 Thread P. Douglas Reeder

T.J. is correct, of course, that my original suggestion would make
multiple copies of the functions.  That's what I get for writing off
the top of my head.   If I understand correctly, what joe t. really
want is something like:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
html
head
meta http-equiv=Content-Type content=text/html; charset=UTF-8
titleSpecialDate/title
script
var specialDateFactory = function () {
var calcIsEaster = function () {
// do something with _this_, which will be a Date object
this.isEaster = true;   // replace with real code
}

var calcIsLaborDay = function () {
// do something with _this_, which will be a Date object
this.isLaborDay = false;   // replace with real code
}

return function () {
var that = new Date();

that.calcIsEaster = calcIsEaster;
that.calcIsEaster();

that.calcIsLaborDay = calcIsLaborDay;
that.calcIsLaborDay();

return that;
}
} ();
/script
/head

body
script
var myDate = specialDateFactory();
document.write(pmyDate.isEaster:  + myDate.isEaster + /p);
document.write(pmyDate.calcIsLaborDay:  + myDate.calcIsLaborDay +
/p);
document.write(pmyDate instanceof Date:  + (myDate instanceof
Date) + /p);
/script
/body
/html


The factory function specialDateFactory returns a Date instance which
has methods calcIsEaster and calcIsLaborDay, and properties isEaster
and isLaborDay.  If you change the value of the returned object, you
can call calcEaster and calcIsLaborDay again to refresh .isEaster
and .isLaborDay.

What's more, the functions like calcIsEaster and calcIsLaborDay can
call each other securely -- no matter how objects returned from
specialDateFactory are abused, variables in the closure are
undisturbed.  So you can securely add lookup tables and helper
functions hidden from the outside.

And this introduces only one closure, so it's fairly cheap.

JavaScript constructors are an anomalous, pseudo-classical things.
If you're not going to compare objects with instanceof, don't bother
with them.  More often, factories are what you really want.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Changing href in onclick function

2009-05-20 Thread P. Douglas Reeder

To put what RobG said concretely, why can't you use:

$('ph').observe('click', function(event) {
if($('ph').href.endsWith('#')) {
event.preventDefault();
new Ajax.Request(geturl.php,
{
onComplete: function
(request) {
$('ph').href =
request.responseText;
location.href
=  request.responseText;
}.bind(this)
});
} else {
// allow normal
click function
}

});



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Adding properties to native objects

2009-05-20 Thread P. Douglas Reeder

You may want to use Crockford's factory pattern, rather than using any
sort of constructor:

function specialDateFactory() {
var that = new Date();

that.isEaster = function () {return ...},
that.isLaborDay = function () {return ...},

return that;
}

You can get more sophisticated - creating a prototype object for
special dates, with the functions defined on it, and using closures to
protect it, but I can't write that off the top of my head...



On May 20, 7:50 am, ColinFine colin.f...@pace.com wrote:
 On May 20, 12:16 am, RobG rg...@iinet.net.au wrote:

  On May 19, 9:26 pm, ColinFine colin.f...@pace.com wrote:

   This is a case when you really truly want just the facilities that
   Javascript provides (prototypes rather than classes), and using
   (pretend) classes makes it harder not easier.

  Yes, although some may argue that it is better to create a new object
  that has the required methods and leverages the methods of Date,
  rather than modifying a built-in object prototype,

 Fair comment. But you are still talking about using Javascript's
 prototype, rather than inventing classes. That was my point.
 (I wouldn't have made this remark before I read Crockford's
 Javascript: The Good Parts - that's opened my eyes to the strengths
 that JS has. )

 Colin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Help! How to get document.body height using Element.getDimensions

2009-05-05 Thread Douglas

I hope this snippet helps :o)


[code]
var w = 0,
h = 0;

if (typeof(window.innerWidth) == 'number') {
w = window.innerWidth;
h = window.innerHeight;
} else if (document.documentElement 
(document.documentElement.clientWidth ||

document.documentElement.clientHeight))
{
//IE 6+ in 'standards compliant mode'
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
} else if (document.body  (document.body.clientWidth ||
 document.body.clientHeight))
{
//IE 4 compatible
w = document.body.clientWidth;
h = document.body.clientHeight;
}
[/code]


On Tue, May 5, 2009 at 1:14 PM, kimbaudi kimba...@gmail.com wrote:

 Hi, I am unable to get the height of the body tag using
 Element.getDimensions although I can get the width of the body tag
 fine. How can I get the height of the body tag? I have my simple
 code pasted at http://pastie.org/468828. Here is the snippet of code
 below as well:

 function alertBodyDim() {
       /* $('main') refers to body id=main */
        var dimensions = $('main').getDimensions();
        alert(dimensions.width);
        alert(dimensions.height);

 }

 - Paul K
 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense. ~Buddha

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Recommended and Disrecommended DOM Methods

2009-04-19 Thread P. Douglas Reeder

I suppose compiling a list would be a useful exercise, and I can post
it on the wiki for other newbies.



On Apr 18, 5:56 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 I don't think there's a list quite like what you're asking about, no,
 but if you have a read through the API docs[1] and in particular the
 docs for Element[2], that will give you a pretty good idea of what you
 can do with Prototype vs. what you'll need to go direct for.  Can't
 imagine that's all that useful a reply, but FWIW...

 [1]http://prototypejs.org/api
 [2]http://prototypejs.org/api/element/

 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Apr 17, 7:46 pm, Doug Reeder reeder...@gmail.com wrote:



  Is there a list of which DOM properties and methods are useful when using
  Prototype, and which are unnecessary, given the availability of Prototype
  methods?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Client-side File Processing

2009-04-14 Thread P. Douglas Reeder

I created the following HTML file to test your function and get the
following errors:

1)  The file input element returns only the file's name, so I don't
see how your function could load the file in.

2) Under Safari 3 and later, I get a TypeError: Result of expression
'xmlDoc.load' [undefined] is not a function. when your function
attempts to call xmlDoc.load()

3) Your function always returns null, under Firefox 3.0.8 and Safari 4
beta, presumably because it only has a file name, not the file path.
It does appear to work under Opera 9.51.  [all under OS X 10.5.6]




!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
  head
titleLoad File/title
meta http-equiv=Content-Type content=text/html;
charset=UTF-8
script src=../prototype.js/script
script
function loadXMLFile(fileName) {
  var xmlDoc;
  // W3C compliant
  if (document  document.implementation 
  document.implementation.createDocument ) {
xmlDoc = document.implementation.createDocument(,,null);
  } else {
// IE model
try {
  xmlDoc = new ActiveXObject('Msxml2.DOMDocument');
} catch( e){}
  }
  if (xmlDoc) {
xmlDoc.async = false;
try {
  var loadOK = xmlDoc.load(fileName);
} catch(e) {
alert(e);
}
  }
  return loadOK? xmlDoc : null;
}

function doLoadFile() {
var doc = loadXMLFile($F($(fileName)));
alert(doc);
}
/script
  /head
  body
  h1Load File/h1
  input type=button value=Load name=load onclick='doLoadFile
()' /
  input type=file id='fileName' name=fileName value=
width=50 /
  /body
/html




RobG wrote:
 On Apr 14, 3:11 pm, Doug Reeder reeder...@gmail.com wrote:
  I'd like to allow the user to select a file from his/her filesystem,  
  and process it locally.  Due to heightened security (or at least the  
  semblance thereof) the value of a file input element is just the name  
  of the file, not the full path, in many modern browsers, so the file  
  path can't be turned into a file: URL that can be loaded via AJAX.    
  Is there a way to access the contents of the file using Prototype?

 Nothing to do with AJAX (where AJAX is a pseudonym for
 xmlHttpRequest).  If it's an XML document, it can be loaded using a
 fairly simple script:

...
 --
 Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: HTML Entity Handling with setValue

2009-03-18 Thread P. Douglas Reeder

When will documentation on Form.Element.setValue() be added to
http://prototypejs.org/api/form/element ?


 4) Prototype way of doing it:

     $(textArea).setValue(content.unescapeHTML());

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype IE 7 error

2008-10-03 Thread Douglas

I could not access any .js file there. You might check out the given
permissions.

On Fri, Oct 3, 2008 at 11:39 AM, ljungi [EMAIL PROTECTED] wrote:

 Hi,

 I' using protoype in combination with the great symfony framework,
 everything worked fine, until now. I just got an email from an user of
 my webservice that the drag'n drop function doesn't work anymore.
 Sadly, he's using the internet explorer 7 and 8beta, and as I'm
 running on a Mac, I can't say how long this problem persists.

 The ie debug-tool says (translated from german, could be expressed
 otherwise in english):

 'Droppables' is undefined

 and

 'Draggables' is undefined

 And thats the point. It works fine with Opera, Safari, Firefox... Even
 epiphany and konqueror have no problems with this simple drag'n drop
 thing.
 I can't say anything about IE6, because there are less than 2 % using
 it on my website.

 If you need to see the website, go on, i created a demo-account:

 www.ld-host.de/login
 User: Demo
 Password: demo

 Navigate to Bilderverwaltung or www.ld-host.de/editfolder/0 and try
 to drag an image from the right side to a folder on the left side
 (Unsortiert, Einer zu viel, ...)

 I hope you guys could tell me a solution. Thanks so long.. :)

 




-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---