473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Scriptaculous problem

Does any peo^le can help me with this script? Event.observe seem to be off

Thank's in advance
HTML>
<BODY>
<script type="text/javascript">

netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead");
</script>
<script type = "text/javascript" src="scriptaculous/lib/prototype.js">
</script>
<script type = "test/javascript" src="scriptaculous/src/scriptaculous.js">
</script>
<H1>Recherche d'une ville us</H1>
<P>Nom de la ville ou code<BR/>
<input id="ville" type="text" />
</P>
<DIV id)"villes"</DIV>
<script type="text/javascript">

function updateVilles (element, valeur) {
//on lance une requete qui interroge le web service
var URL = 'http://xoap.weather.com/search/search';
URL +='?where='+valeur;
var requete = new ActiveXObject('Msxml2.XMLHTTP');
requete.open('GET', URL, false);
requete.send(null);
showResponse(requete);
}

function showResponse(req) {
xmlData = new ActiveXObject("Microsoft.XMLDOM");
xmlData.loadXML(req.responseText);

var html= '';

if xmlData.getElementByTagName('err').length!=0){
var noeud=xmlData.getElementByTagName('err')[0];
html = noeud.firstChild.data;
}
else {
var villes= xmlData.getElementByTagName('loc');
if ( villes.length !=0) {
for (var i=0; i < villes.length; i++)
html += villes[i].firstChild.data+'br/>';
}
else {
html= 'Aucune ville trouvee !';
}
}
$('villes').innerHTML = html;

}

Event.observe(window, 'load', function() {
new Form.Element.Observer('ville',0.5,updateVilles);
});
</SCRIPT>
</BODY>
</HTML>
Sep 9 '08 #1
4 1675
JacK wrote:
Does any peo^le can help me with this script? Event.observe seem to be off
[...]
<http://validator.w3.org/>
<http://jibbering.com/faq/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://groups.google.com/groups?as_q=Prototype.js+OR+Scriptaculous+OR+Scrip t.aculo.us&as_ugroup=comp.lang.javascript&scoring= d&filter=0>
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Sep 9 '08 #2
SAM
JacK a écrit :
Does any peo^le can help me with this script? Event.observe seem to be off
Quand on fait :
<http://xoap.weather.com/search/search?where=Paris>
on a bien un xml (avec une note de licence) avec tous les Paris.
Le search sur "Paris, France" donne encore 2 choix ...
M'a pas l'air coton à dompter ce truc.
<HTML>
<BODY>
<script type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead");
C'est pour pouvoir faire du cross-domain ?
</script>
<script type = "text/javascript" src="scriptaculous/lib/prototype.js">
</script>
<script type = "test/javascript" src="scriptaculous/src/scriptaculous.js">
</script>
<H1>Recherche d'une ville us</H1>
<P>Nom de la ville ou code<BR/>
<input id="ville" type="text" />
</P>
<DIV id)"villes"</DIV>
Là je vois comme un problème ! typo ?
You can't have 2 IDs with same name !

I suppose you wanted to write :

<DIV id="villes"></DIV>

Ça n'aurait donc rien à voir avec "observe()"
<script type="text/javascript">

function updateVilles (element, valeur) {
(...)
$('villes').innerHTML = html;
}

Event.observe(window, 'load', function() {
new Form.Element.Observer('ville',0.5,updateVilles);
});
</SCRIPT>
--
sm
Sep 9 '08 #3
SAM a écrit :
>netscape.security.PrivilegeManager.enablePrivileg e("UniversalBrowserRead");

C'est pour pouvoir faire du cross-domain ?
C'est une solution de contournement pour réaliser une connexion vers un
serveur tiers, ce qui est interdit en standard sous firefox.
>
></script>
<script type = "text/javascript" src="scriptaculous/lib/prototype.js">
</script>
<script type = "test/javascript"
src="scriptaculous/src/scriptaculous.js">
</script>
<H1>Recherche d'une ville us</H1>
<P>Nom de la ville ou code<BR/>
<input id="ville" type="text" />
</P>
<DIV id)"villes"</DIV>

Là je vois comme un problème ! typo ?
yeah thanks
You can't have 2 IDs with same name !
I don't understand.
>
I suppose you wanted to write :

<DIV id="villes"></DIV>
C'est rectifié.
>
Ça n'aurait donc rien à voir avec "observe()"
Mais je n'arrive pas à le faire fonctionner.

merci

Sep 9 '08 #4
SAM
JacK a écrit :
SAM a écrit :
>></P>
<DIV id)"villes"</DIV>

Là je vois comme un problème ! typo ?
yeah thanks
>You can't have 2 IDs with same name !
I don't understand.
on ne peut donner un même nom à plus d'un ID
(mais tu dois le savoir)
><DIV id="villes"></DIV>
C'est rectifié.
>>
Ça n'aurait donc rien à voir avec "observe()"
Mais je n'arrive pas à le faire fonctionner.
Alors ... comme je ne pratique pas ces biblis ...
reste à piocher les liens donnés par OreillePointées (PointedEars)
merci
Ben ... j'espérais que c'était seulement ça.

Autre chose, je ne vois pas à quoi sert 'element' dans :
function updateVilles (element, valeur) { ...
et je ne sais comment tu y passes la valeur ( value ?)

J'essaierais :

function updateVilles (element) {
var valeur = element.getValue();
Le site esspécialisé n'est pas très disert pour Form.Element.Observer
<http://prototypejs.org/api/timedObserver/form-element-observer>

Pour ton surveillant :

Event.observe(window, 'load', function() {
new Form.Element.Observer('ville',0.5,updateVilles);
});

là 'updateVilles' est la fontion de callback
mais ... comment y sont passés les arguments ?
(element et value)

Event.observe(window, 'load', function() {
new Form.Element.Observer('ville',0.5,
function(){
updateVilles('',$('villes').value);
});
});

pit être ? si je me réfère à :
<http://prototypejs.org/api/timedObserver>

--
sm
Sep 9 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jake Barnes | last post by:
I've read over the documentation for these effects: http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo I want to include them on my page. I tried attaching using onload, but...
1
by: lakilevi | last post by:
Hi! I have a problem in integration of script.aculo.us's scriptaculous.js with the http://www.javascripttoolbox.com/lib/objectposition/source/position.js file. I think the both file has a Position...
3
by: lakilevi | last post by:
Hi! I have a problem in integration of script.aculo.us's scriptaculous.js with the http://www.javascripttoolbox.com/lib/objectposition/source/position.js file. I think the both file has a...
2
by: darrel | last post by:
I've been working on a side project off and on (more off than on) for a year or so. Overtime, it's become a bit of a frankenstein. It uses the Scriptaculous javascript library for a lot of...
1
by: gezerpunta | last post by:
Hi folks :) We use scriptaculous draggables inside a scrollable div. Everything works fine if we turn on the option "Ghosting" (this enables items to be dragged outside the div with a sroller...
3
by: libsfan01 | last post by:
hi i have a page which contains an visible nav down the left-hand side. when you click a button it needs to appear. i thought it would be cool to use scriptaculous to make it slide down. can...
3
by: ChiliFingerX | last post by:
I am at the end of my rope. I wrote an application, it runs locally on my laptop, nothing to do with the Internet or client/server stuff. Using Firefox 2.0 I open my main 'GUI.html' file. ...
1
Jezternz
by: Jezternz | last post by:
Scriptaculous needs an official forum but does not have one so I am asking here :). note you will need to be familiar with scriptaculous to help me here. Basicly I have a script that has a...
2
by: AndrewC | last post by:
I am using the Scriptaculous/Prototype libraries to build a project and I really want to have an effect like the mootools download page (http://www.mootools.net/download) where when you mouse over...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.