Troy III 272 Posting Pro

Now, @Troy III, I got a little lost about your solution. You suggest to have a "strip" do you mean like having 5 images in one?I won't need a forward loop because I want the animation to stop when it comes back to the first image.
I start working on the code now.
thanks

Yes, a sprite; - [all anim.,images in one img file].
Here is one [randomly chosen article] about sprites.
http://sixrevisions.com/css/css-sprites-site-speed/
And here is a link that may probably help you construct your sprite image with ease.
http://csssprites.com/bare.html

Troy III 272 Posting Pro

Well, the denial phase sometimes lasts longer than anticipated.
In practice xhtml never existed.

Troy III 272 Posting Pro

@smartness [post#1]

This will do just fine:

function ifChecked(form){for(x in form.elements)if(form.elements[x].checked)return!0}
Troy III 272 Posting Pro

Hi guys, I would like to add sth to my website but I am not sure what's the best way to achieve this. It is a kind of image gallery, say I have 10-20 images and I want to display all of them one after another one from the beginning to the end and then going back. So, let's take the 5 attached images: as you can see they have been taken in sequence so what I have in mind is to have a page where you can see only pic 87: you click a button sayin probably "run sequence" and from pic 87 goes very very quickly all the way to pic 91 so the effect is almost like a video and then straight away goes back to 87, so you get a rewind effect.
Now I am not sure whether it is a good idea to achieve this with css and jquery or somehow record a video perhaps with moviemaker to get that effect. I guess the video has the advantage of being played with every browser whereas the script requires more adjustements.

I haven't written any code yet but I think each picture can have a different z-index and with jquery I can change the order when I click the "run sequence" button, i will figure out how hopefully
thanks

There are lots of ways to achieve 2D animations on a normal browser without using anything else but js css and of curse the contents …

Troy III 272 Posting Pro

Ok. Then how can i get the context path.?
I have a code like this.

win = open('/dnweb/pages/favorite.jsp','Print_Favorite_win',settings);
				win.focus();
				break;
			}

i have to change

/dnweb

context as dynamically.

You can use a variable value concatenation with the string path value.

var contextPath = "";
    contextPath = "\/dnWeb2"; //the value assignment is done for illustration purpose here
            win = open( [B]contextPath[/B] + '/pages/favorite.jsp','Print_Favorite_win',settings);
Troy III 272 Posting Pro

@TroyIII

1. You implemented the function in recursive which could be easily implemented in iterative fashion.

2. It is a lot more obscure for beginner to understand (and obvious that the OP is one). Also, you have no comment at all in your code...

3. Furthermore from the way the OP implemented, I believe the OP may want to add more flexibility in number of row as well as power. Yours is for rows only.

4. One more downside is that a recursive function can take all resources available in computation a lot faster than an iterative function (and JavaScript is a scripting language which is slow). I am not really sure that this approach is necessary.

That's to much of a nonsense for one [plain (solution) points theft] occasion.

1. I don't misuse the "for" loops when not necessary.
2. That's why the note: "if any questions..." in my reply stands for!
3. Wrong: "how would I add any additional rows without it showing more value?" stands for expanding the rows but restricting columns. Meaning: The task requires fixed number of columns, [powers 1,2,3] but variable number of rows.
4. Recursions are more flexible; more programmable; meaning: more control. The Loop takes up more resources because loop process is more aggressive.

Troy III 272 Posting Pro

This needs to be qualified Troy.

"The working group on xhtml is discontinued" - True. The W3C XHTML working group's charter lapsed in 2010.

"They've dropped it completely" - False. The reason that the XHTML working group's charter was allowed to lapse is that XHTML is now encompassed by the HTML working group. If anything, this makes XHTML more authoritative and here-to-stay, not less.

Under current W3C Working Draft and WHATWG Living Standard, HTML and XHTML are alternative "concrete syntaxes", both of which, according to the standards, conform to the same "in-memory representation" standard known as "DOM HTML" or "DOM" for short. The standards also allow for other "concrete syntaxes".

In both W3C and WHATWG documentation (each is a variant of the other, and the two working groups "work together"), "The HTML syntax" and "The XHTML syntax" are adjacent chapters:

For whatever reason, you may not like XHTML, but please don't start false rumours of its demise.

XHTML is alive and kicking.

Of course, if you can point to something that indicates otherwise, I will be pleased to read it.

Best wishes, as always

Airshow

No. It's dead.
Plain dead, -not 'gone to heavens'; not 'they're with god now'; not 'they've passed..(into another world)" which are nothing but classical examples of euphemism of the direct notion.

No, the
"working group on xhtml is discontinued" means: they're gone; …

Troy III 272 Posting Pro

Sorry, when I said "its" I meant [or at least I was thinkging] the height of the wrapping div.

Troy III 272 Posting Pro

That's because xhtml is not HTML.

Use <!DOCTYPE html> instead. The working group on xhtml is discontinued. They've dropped it completely.

Troy III 272 Posting Pro

Just don't specify its height.

[and why do you need to use that godamn xhtml when working on HTML?!!]

Troy III 272 Posting Pro

Great news...
I'll be soon switching back to IE8.
Thanks!

Troy III 272 Posting Pro
function toPower(o,n,i,x){ 
      !n?(n=10,i=1) : i+=1;
      !toPower.x?toPower.x="":0
          if( i <= n ){ toPower[i]=
		"<tr align=right><td>" + i + "<\/td><td>" +
                   Math.pow( i, 2 ) + "<\/td><td>"+
                   Math.pow( i, 3 ) + "<\/td><\/tr>";
	toPower.x += toPower[i];
	return toPower( o,n,i,toPower.x ) }
	else{
	document.write( "<table>" + x + "<\/table>");
	}
   }

toPower(0,15,0)

If any questions just ask.
p.s.:
Using onload=toPower will fallback to 10 rows a table

Troy III 272 Posting Pro

both scripts are using the same name variable -the seccond one overwrites the value of the first - therefore the first one will stop functioning because of the wrong value assigned by the second script.

find it; rename it; solved.

Troy III 272 Posting Pro

onbeforepaste event anybody?

Troy III 272 Posting Pro

well, this is all wrong, and it doesn't have to do anything with hiding behind a proxy or not.

Troy III 272 Posting Pro

As I said, it's not as concise as Troy's but has the enormous advantage of using XML (that's an intentional wind-up for Troy).

Care to explain the word "enormous" in this regard?

Troy III 272 Posting Pro

Yeah, that something I overlooked while trying to imose some oreder int the script

var h=[],v=[],o,cl,id,top,left,bottom,right,tv,lv,bv,rv,result;

This is how it should have looked in e completed code

Troy III 272 Posting Pro

I tried with arrays but I get Uncaught SyntaxError: Unexpected token [(look at the comment in code)

for(i = 1; i <= 30; i++){
	var h = new Array();
	var v = new Array();
	var o = $("#v"+i).css("opacity");
	if(o < 1){
	var v[i] = 0;//on this line
	}else{
	var v[i] = 1;
	}
	var o = $("#h"+i).css("opacity");
	if(o < 1){
		var h[i] = 0;
	}else{
		var h[i] = 1;
	}
	var cl = parseInt($("#"+i).attr('class'));
	var id = parseInt($("#"+i).attr('id'));
	var top = cl;
	var left = id;
	var bottom = cl+5;
	var right = id+5;
	var tv = v[top];
	var lv = h[left];
	var bv = v[bottom];
	var rv = h[right];
	var result = tv+lv+bv+rv;
	if(result==4){
		$('#'+i).html("X");
	}
}

The thing is, - I don't understand what you are trying to do.
You should have tried to correct that error instead of escaping from water into the fire.

First thing's first: you don't declare variables inside the loop.

var h,v,o,cl,id,top,left,bottom,right,tv,lv,bv,rv,result;
for(i = 1; i <= 30; i++){
		o = $("#v"+i).css("opacity");
	if(o < 1){ v[i] = 0} else{ v[i] = 1 };
		o = $( "#h" + i ).css( "opacity" );
	if( o < 1 ){ h[i] = 0 } else{ h[i] = 1 };
		cl = parseInt( $( "#" + i ).attr( 'class' ) );
		id = parseInt( $( "#" + i ).attr( 'id' ) );
		top = cl; left = id; bottom = cl + 5; right = id + 5;
		tv = v[top]; lv = h[left]; …
Troy III 272 Posting Pro

This is the fastest and shortest I can do for you:
(The MDT/MST will depend on your clock settings. If you've chosen MST, MST display it will!)

<!DOCTYPE native>
<html>
<head>
<title>Live Clock</title>
   <style>
	div
	{
		background-color: silver;
		border: 1px solid gray;
		padding: 1px 5px;
		border-radius: 4px;
	}
   </style>
</head>
<body>
<div>
	Time: &nbsp; <input id="time">
</div>
<script>
onload=
	liveClock=
		function(){
		var tm = Date();
			tm=(tm.toString()).split(' ');
			time.value = tm[3]+" "+tm[4];
		setTimeout("liveClock()", 500);
	}
</script>
</body>
</html>
Troy III 272 Posting Pro

But why variables?! Why not a #table or arrays instead?
30+ variables only for vv?!!
That's bloody expensive ...

Why don't you try arrays like:

vv[num] = value

Or even better, try explaining the goal you're after.

Sometimes it's not the code or lack of a sufficient knowledge - its the angle of approaching, and the means we choose and it happens that sometimes we chose the most difficult ones.

Troy III 272 Posting Pro
function eventHandler(e) {
  e = e || window.event;
  var target = e.target || e.srcElement;
  /*
  the rest of your handler here
  */
}

This and more good tips here: http://javascript.crockford.com/style2.html

Airshow

or better say:

function curent_poNode(){
	poNode = event.srcElement;
	}

now you can use your "poNode" to reference any event-source-element of the document, on browsers including: IE*; Chrome*; Opera*; Safari*; -excluding FF only.

Troy III 272 Posting Pro

Well, practically it is not!

poEvent is not "just like saying e.target" at all. In fact its just like stating 7 meaningless letters and let the browser guess what you were thinking.

Neither "e.target" has any meaning at all. You need to first define "e", because it is also undefined by default.

Troy III 272 Posting Pro

rinjin07 - haven't decided yet?!!

Troy III 272 Posting Pro

here is a simple working code for IE and alike:

<!DOCTYPE native>
<html>
<head>
	<title>a limited length textbox</title>
<style>
</style>
</head> 

<body>
    <textarea id=txt rows=6 cols=40></textarea>
    <br>
    <input id=cnt size=3 value=30>
    Characters Remaining

<script>

max=cnt.value;

txt.onkeyup = 
txt.onkeydown = function count(){ cnt.value = max - txt.value.length }
txt.onkeypress=	function(){
			if((cnt.value=max-txt.value.length)<=0){
			return false
			}
		}
</script>  
</body> </html>

Don't sweat over firefox - you can't make it happen.

Troy III 272 Posting Pro

Can you make firefox or any thing else for that matter understand what poEvent is, if it is, for whatever it is, first?!

Troy III 272 Posting Pro

The execCommand([params]) could make you happy.

Troy III 272 Posting Pro

well that's what you get for using xml.
converting it all into a js-DSO [javascript data source objrct] on some rich text editor is a breeze.

You take a sample of mine compare it with your xml: find the diferences an use find / replace than copy-paste it all in a plain text document . And yes nowdays its called a JSON.

You could use some XML to JSON converter but youre out of luck -your xml is mallformed according to dreaconian error handling of you data formulation on the xml parser I gues.

-but here are two possible automatic conversions made online:

{"partners":{"partner":[{"@attributes":{"lat":"23.709921","lng":"90.407143","title":"ARANYA (Bangladesh)- WTFO Member","desc":"ARANYA is a craft research and development organization which has been working with the revival and promotion of the fine craft traditions of Bangladesh for more than two decades. As a fair trade micro-enterprise, ARANYA's partnership with craftspeople guarantees fair wages and ensures that they are not exploited or undervalued. ARANYA has revived the use of natural dyes in Bangladesh and has trained hundreds of artisans in dyeing and printing techniques. It works in hand-woven, embroidered and block printed handloom silk and organic cotton fabrics. It has developed and worked with the Jamdani Nakshi Kantha techniques, unique to Bangladesh."}},{"@attributes":{"lat":"-16.5026527","lng":"-68.1622267","title":"ASARBOLSEM (BOLIVIA)- WFTO Member","desc":"Asociaci\u00f3n Artesanal Boliviana Se\u00f1or de Mayo is a co-operative working in Bolivia since 1989. It has more than 390 members, spread our throughout Bolivia. Of the members, 98% are women and disabled people. Se\u00f1or de Mayo specialises in …
Troy III 272 Posting Pro

Well... :')
-There's no such thing as evil Language i.e.,[any communications protocol], the thing with xml and other web filth, is that they are practically unusable.
xhml is dead, thank goodness - long live HTML.

But anyway feel free to post it, I like your coding manner.

p.s: have you tried the last revision? Only tested on IE9 and Fx5 but I'm sure it will work full range, way back to IE4.01.

Regards.

Troy III 272 Posting Pro

rinjin here is your simple navigable version.

<!DOCTYPE native>
<html>
<head>
<style>
#map_canvas{width:720px;height:480px;}
</style>
<script id=DSO src="partners.txt"></script>
<script id=API src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
n=-1;
function openMap() {
   n<5?n+=1:n=0
	var myLatlng = new google.maps.LatLng(partners[n].lat, partners[n].lng);
	var marker = new google.maps.Marker({position:myLatlng, title:partners[n].title}); 
	var myOptions = {zoom:8, center:myLatlng, mapTypeId:google.maps.MapTypeId.TERRAIN};
	var map = new google.maps.Map(map_canvas, myOptions);
	marker.setMap(map);
	title.innerHTML = partners[n].title;
	desc.innerHTML = partners[n].desc;
	goNext.onclick = openMap;
	}
	onload = openMap;
</script>
</head>
<body>
<div id=disp>
	<h1 id=title> </h1>
	<div id=map_canvas> </div>
	<p id=goNext><a href='javascript:void 0'>go next</a></p>
	<div id=desc> </div>
</div>
</body>
</html>

And no don't use the bloody UTF it doesn't support all characters (used) - leave it as is, let the browser detect encoding, it does a better job than me. This revision uses markers also...

Have fun
Troy III p.a.e.

Troy III 272 Posting Pro

Just drop the filthy XML completely, that was never meant to be and wasn't even supposed to exist. It's a worthless artificial w3c crap that was never meant to be used in practice anyway.


Here, try this:

<!DOCTYPE native>
<html>
<head>
<meta charset="utf-8">
<style>
#disp
	{	font: normal 12pt calibri;
		width: 600px;
		margin: auto;
	}
#map_canvas
	{	
		width: 600px;
		height: 400px;
		border-radius:5px;
		border: gray 4px double;
	}
#desc	
	{	
		text-align:justify;
	}
</style>
<script id=DSO src="partners.txt"></script>
<script id=API src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
function openMap() {
	var myLatlng = new google.maps.LatLng(partners[0].lat, partners[0].lng);
	var myOptions = {
		zoom: 8,
		center: myLatlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		}
	var map = new google.maps.Map(map_canvas, myOptions);
	
	title.innerHTML = partners[0].title;
	desc.innerHTML = partners[0].desc;
	}
	onload=openMap;
</script>

</head>
<body>
<div id=disp>
	<h1 id=title> </h1>
	<div id=map_canvas> </div>
<br>
	<div id=desc> </div>
</div>
</body>
</html>

and here is your brand new js-DSO

{partners=[
	{
		lat:"23.709921", 
		lng:"90.407143", 
		title:"ARANYA (Bangladesh)- WTFO Member", 
		desc:"ARANYA is a craft research and development organization which has been working with the revival and promotion of the fine craft traditions of Bangladesh for more than two decades. As a fair trade micro-enterprise, ARANYA's partnership with craftspeople guarantees fair wages and ensures that they are not exploited or undervalued. ARANYA has revived the use of natural dyes in Bangladesh and has trained hundreds of artisans in dyeing and printing techniques. It works in hand-woven, embroidered and block printed handloom silk and organic cotton fabrics. It has developed and worked with the Jamdani Nakshi Kantha techniques, unique …
Troy III 272 Posting Pro

thanks guyssss, but i dont even get an alert or anything. still just showing nothing on the page, no map, no anything, no matter what i do except for the hard coded version :<

Hello

You need to debug this step first:

var oReq = getXMLHttpRequest();
var xmlDoc;

function getXMLHttpRequest(){
        return new window.XMLHttpRequest;
	}

function handleRequest(){
	    if( oReq.readyState == 4 ){
	        if( oReq.status == 200 ){
	xmlDoc = oReq.responseXML;
	procesXMLData() 
		}
	    }
	}
	
if (oReq != null) {
	    oReq.open("GET", "partners.xml", true);
	    oReq.onreadystatechange = handleRequest;
	    oReq.send();
}
	
function procesXMLData(){
	var lat, lng, title, desc;
	var lats=[], lngs=[], titles=[], descs=[];
	var partners=xmlDoc.getElementsByTagName("partner");

	alert(partners[0])	
	}

Because If you've only pasted the previous code without inspecting your following declarations - you'd undoubtedly fail. Because the function {procesXMLData} is left open [not finished] for you to work on. If nothing else, it lacks its final closing "}" and will fail to register / cause a javascript error before anything else. As it did.

OK than, first:
Watch if(this shortened code) will give you an alert box, -If it does:

A) But theres nothing useful in its message content (as I sugested earlier) - format your xml doc reference as absolute i.e.: "http://mydomain.com/mycordsfolder/partners.xml" and refresh you page.
If this doesn't solve the problem: please make sure that your "partners.xml" file: 1. Exists; 2. Is in the same folder; 3. Contains Tags of type <partner> (in same case xml sensitive nature).

B)But if there is an object in …

Troy III 272 Posting Pro

Send the html code of your "Currently I have an update button on each row where the user can update amended fields." module.

Send the current working script) code associated with these buttons.

We might be able to translate it to what you actually need.

Troy III 272 Posting Pro

Hello rinjin07
you are using AJAX call in sync context.
The "A" in AJAX stands for "Asynchronous"

Therefore this code might get you walking:

var oReq = getXMLHttpRequest();
var xmlDoc;

function getXMLHttpRequest(){
        return new window.XMLHttpRequest;
	}

function handleRequest(){
	    if( oReq.readyState == 4 ){
	        if( oReq.status == 200 ){
	xmlDoc = oReq.responseXML;
	procesXMLData() 
		}
	    }
	}
	
if (oReq != null) {
	    oReq.open("GET", "partners.xml", true);
	    oReq.onreadystatechange = handleRequest;
	    oReq.send();
}
	
function procesXMLData(){
	var lat, lng, title, desc;
	var lats=[], lngs=[], titles=[], descs=[];
	var partners=xmlDoc.getElementsByTagName("partner");

alert(partners[0])	/*if you get this alert you are good to go
		if alert 'undefined' or something bad:
		change "partners.xml" to its absolute url
		else remove this alert and continue debugging hereon
		if the rest of the script is good but still no go
		re-check your html code as adviced by Airshow */

	for (var i=0;i<partners.length;i++) {
		lat=partners[i].getAttribute("lat");
		lats.push(lat);
		lng=partners[i].getAttribute("lng");
		lngs.push(lng);
		titles=partners[i].getAttribute("title");
		titles.push(title);
		descs=partners[i].getAttribute("desc");
		descs.push(desc);
	}
	
	var latlng = new google.maps.LatLng(lats[0], lngs[0]);
	var myOptions = {zoom: 11, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP};
    	        var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
	
	for (i=0;i<partners.length;i++){
			latlng = new google.maps.LatLng(lats[i], lngs[i]);
			marker= new google.maps.Marker({position: latlng, map: map, title: titles[i]});
	}

Regards @all, Troy III

Troy III 272 Posting Pro

You are wellcome, nice day 2U2.

Troy III 272 Posting Pro

first discribing the error
and posting some code of the faulty lines
and lastly, where are you calling these commands from?
would rise your chances for solution a lot.

because you see there used to be a working hack for even closing a single (user opened) main window through script without a prompt by simply stating:
self = opener;
self.close(); //or something
[it doesn't work anymore - but not totally sure I haven't tried it since decade ago].

Troy III 272 Posting Pro

Dear Airshow and Troy,
Appreciate you guys man for the help and time. Lets see how the checklist will work home it will do some work for me too. Thank you.

"50% of the solution lies in accurately describing the problem!" by Airshow
Thats because he's being humble since: accurately describing the problem yelds no less than 99.9% probability that somebody will find you a solution.

Troy III 272 Posting Pro

Try referencing with:

opener.document.forms['f1'].p_name.value = document.forms[frm].c_name.value
Troy III 272 Posting Pro

But of course I have - have you?

As I already mentioned: "saying 'no and definitely not' without a trial, is close to being wrong."

My trial revealed that it accumulates all events captured during the specified time (creating an independent timer for every key stroke) than fires them all in one sequence while accumulating new ones. That's exactly what was bothering our guy minitauros and the reason why he posted this question. He also got stuck at the same point himself.

At first glance, this may seem like a silly simple problem to solve; but, it just aint that simple! - Some of the best coders to date may heavily sweat over it and perhaps not even solve it - at least not without some heavy stunts and edgy acrobatics of multi forked functions. Or three separate functions trying to keep the state of things and passing from one to another.

In fact, there is a complete library namely Rx.js which deals with this and similar problems, but they are licencing it...commercially I think, or perhaps they already did.

Nice talking to you.
Regards

Troy III 272 Posting Pro

Nope!
This is the only working solution offered here so far - and it not only works perfectly and rock solid reliable but it is the shortest and the cutest one you may ever see.

Otherwise, the code you proposed does exactly what this guy has problems with.
It fires only once - but when it fires - it fires them all.

My function does exactly what he asked for, executes only once and only after the last stroke.


Regards

Troy III 272 Posting Pro

Yes. You don't understand the entire thread nor do you understand my comments on your previous piece of code. The setTimeout needs to be cleared for the problem to be solved, and in your first piece of code you did that on the wrong place and now you don't do it at all (and it's not that incomprehensible as you may find it). What you need is something like stbuchok already posted, for example:

if(timeout) clearTimeout(timeout);
var timeout = setTimeout(function() {
  // actions..
}, 1000);

You are right, of course, -but the title says:
Execute action after x seconds only once

Whereas: ;setTimeout(function(){alert('1 second passed')},1000); does exactly that.
(no need to delete an anonymous function because as soon as it has fired, it is gone - went garbage collected - never to come back again.)
That's what he asked and that's what it does.

But if the task is something else - it is again - not only your fault - but mine too!
:')
If the guy wants to cancel the timed function any time the user has caused another keyup event, yet register the last one.
Well than, it's not that simple as it looks...

Here fore I offer this solution:

function timeShift(){
		clearTimeout(timeShift);
		timeShift=setTimeout("yourFunction()",1000);
		}

executes only after the client has stopped typing.
Call

yourElement.onkeyup=timeShift

Define yourFunction() anywhere. (complex functions get ugly when put inside the timer).

Regards @all.

Troy III 272 Posting Pro

Why not have a checklist?!

Troy III 272 Posting Pro

can you describe the task u are trying to achieve (but from the user poin of view) and how - because I'm not being able to understand what needs to do what, nor how or why.
why are those optons single/double, or what's the deal with the deleting precaution, cause I dont see anything of a kind there; or why do you need more dups of the same options etc..., because the list is finite I think that your aproach to the problem may be wrong, but about this; latter.

Troy III 272 Posting Pro

Thanks Airshow,
Yes I've ben looking at it... but couldn't deduce more than my already established fear that If I'm going to support other browsers as well, I'll be forced to hardcode the list by hand and use up an extra 1KB on a platform targeting a max 4KB.
Or leave it to the back end coder.

If the coder wants to have, say only the click event rewired and available for scripting with an "atevent" syntax on my "Discrete Event Model", let them choose to declare only those events they'll actually use on their current projects.

But again, having them programmatically available and by default is a better coder experience. Yet having a ~1KB long hardcoded list containing only event name declarations is just a little bit to much.

Your suggestion is good and pointing towards my aim but in inverse order.
The isEventSupported would be a nice tool if only I knew what event to check for. Unfortunately and comparatively simple, in Explorer, even this kind of task - when knowing what and where to look for - seems like a little piece of cake.
example:

isEventSupported =
	function(tag, event){
		return document.createElement(tag)[event]===null;
		};

usage:

alert( isEventSupported(“DIV”, “onclick”) ); //TRUE

Best Regards

Troy III 272 Posting Pro

That's the whole point, or is it?
Are you trying to actually convince me that you don't have a clue about timed scripts programming(!?!) -cause you're almost there.

Let's than make it a completely incomprehensible (a one liner - my favorite) - but yet again, a perfectly working example you never saw before.
A delayed function that runs (as requested) only once:

;setTimeout(function(){alert('R U Late?')},1000);

Any other comments?!...

Troy III 272 Posting Pro
<!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" >
<head runat="server">
    <title>Events !</title>
    <script type="text/javascript">
        window.onload = function() {
            [B]//Only this occurs[/B]
            document.getElementById('anImage').onclick = function() {
                alert('F-14 Tomcat !');
            }
            [B]//This gives the result of the first[/B]
            document.getElementById('anImage').ondblclick = function() {
                alert('Not again ! !');
            }
            [B]//Nothing happens!!!![/B]
            document.getElementById('anImage').onkeydown = function() {
                alert('Please !');
            }
        };
        
    </script>
    <style type="text/css">
        #anImage
        {
            height: 300px;
            width: 372px;
        }
    </style>
</head>
<body>
    <img src="1012562.jpg" id="anImage" />
</body>
</html>

Why is that only the first event occurs ??

Please help !

You mean "onmousedown" perhaps?
Image cant fire the keyboard event without heaving received focus, but by default images cant have focus by themselves.

This will work
and that's the order of events.
*

<script>

        window.onload = function() {
            //Only this occurs
            document.getElementById('anImage').onclick = function() {
                console.log('F-14 Tomcat !');
            }
            //This gives the result of the first
            document.getElementById('anImage').ondblclick = function() {
                console.log('Not again ! !');
            }
            //Nothing happens!!!!
            document.getElementById('anImage').onmousedown = function() {
                console.log('Please !');
            }
        };

</script>
  <img src="1012562.jpg" id="anImage">
LOG: Please ! 
LOG: F-14 Tomcat ! 
LOG: Not again ! !

if you really want a keyboard event onkeydown you need to first make the image focusable, and again it will fire the key down event only while retaining focus... once it has lost focus, it will no longer fire keyboard events.

Troy III 272 Posting Pro

What are window.onblur/window.onfocus used for ????

Please help !
Thanx

The window: onblur and onfocus are events of a browser window which were used to determine if the app is in front or behind another app.

This way web jerks were able to detect when you switched to another window and bring it back in, on top of the current and continue to annoy you.

Troy III 272 Posting Pro

This is my first post of a type: "question", so bare with me...

I need to obtain a list of supported events on an encountered browser version programmatically, ie, via script.
Since Explorer exposes its events on document object I can do something as simple as this:

;for(x in document)if(/^on/.test(x))alert(x);

(!warning: long list ahead..., you can use the console.log(x) instead)
..and simply store them on some appropriate object for latter use in my program flow.

Is there a sort of hack or "a hidden corner" or whatever, that would enable us to build a list of events available on Firefox in a similar fashion?

Any idea will be greatly appreciated.

Thanks.

Troy III 272 Posting Pro

No, definetely not. Clearing a timeout just before it's actually finished makes no sense.

:')
That's how you read it, but it is the other way around! You've read it wrong and of course saying "no and definitely not" without a trial, is also wrong.

Troy III 272 Posting Pro

NOTE: depending on data after the question mark (?)- when available, the "page_id" value can be accessed as well.

Troy III 272 Posting Pro

Hello,
I'm converting a HTML/PHP website to wordpress. I'm showing real estate listings on the Google Maps. I've been able to sort out all the problem when converting to wordpress but I'm stuck at a point.

Here is the code;

parameters: function() {
				var result = {};
				var url = window.location.href;
				var parameters = url.slice(url.indexOf('?') + 1).split('&');
 		
				for(var i = 0;  i < parameters.length; i++) {
					var parameter = parameters[i].split('=');
					result[parameter[0]] = parameter[1];
				}
				return result;
			}

Here are the details;

The page URL is http://domain.com/?page_id=113
I'm doing the AJAX requests to show the listings according to visitor's defined fields.
Actually, the requests will be made like this;
http://domain.com/?page_id=113&low=123&high=324 etc

In my previous script, it was http://domain.com/result.php?low=123&high=324

Now how can I do it in wordpress using slice and split.


Any kind of help will be really appreciated.

Regards

If your var url = location.href; is in: http://domain.com/result.php?low=123&high=324 format.

Use this:

[B]; eval(url.split("?")[1].split("&").join());[/B]

Now you can access your "low" / "high" values by simply calling:
low and high respectively.

alert(low);
alert("Coords( " + low + " : " + high + " )" );

and consider it - done!