Troy III 272 Posting Pro

Unfortunately not.

Consider what would happen with an initially empty paragraph in any browser that supports element.innerText but not element.innerContent . oElement.innerText would be falsy (empty string) and the statement would assign oElement["textContent"] = myVarText . Opera, FF, Chrome, Safari and IE9 would be fine but IE5.5, IE6, IE7 and IE8 would fail silently.

There are still enough IE5.5/6/7/8 users out there to worry about.

How about?:

oElement[oElement.hasOwnProperty('innerText')?"innerText":"textContent"] = myVarText;

Airshow

:)

-(You mean "textConent"!),
Yes I must admit that I wrote it [as a fast patch and go] on a wrong assumption that an elements predefined property values are all initially "null" as are those of event properties. But thankfully I was wrong!
Properties like innerText or textContent should have their initial values Empty but of a correct Data Type (as should other types of properties), in this case: of a String Type.

An Empty String [""} just like "null" represents the [empty] type of the given property value, a correct one -(to make e digression) that's why typeof null should return "object", [and it does return "object"], not "null" -because 'null' doesn't mean anything at all.

I'm not saying that having a complementary "typeOf" operator [with a capital O] which would return "null" for null, would harm anything, on contrary -I think it's a must have operator. Its acting would be analogous to == and === comparison syntax, - implicit vs explicit : dynamic vs static.

That would be a great advance since …

stbuchok commented: Great discussion +7
Troy III 272 Posting Pro

Try
var x=xmlDoc.getElementsByTagName("CD"); alert(x)

If your alert doesn't contain what you asked for, it means that your xhtml request failed. So you should examine your xmlhttp request code in more detail and see if its complete.

Troy III 272 Posting Pro

sorry, cant fix jQuery. And since I don't see or know by hart how is jQuery hacking the existing html code to achieve its functionality, there's not much I can add, except that maybe names and ids used as as a couple are confusing the browser api.

Troy III 272 Posting Pro

Is .innerText cross-browser there days? FF was always the odd-man-out but maybe they fixed it at some point.

If you always want a space at the end, then (depending on exactly what effect you want and why you want it) you may be able to render it with CSS padding-right instead of text.

Airshow

*
Yes, but that fully satisfies roughly 90% of your clients. Chrome understands it, Safari understands it, Opera understands it, all versions of IE understand it [these alone constitute more than 67% of the "pie" in total.
**
Using css on dynamically generated and parsed content defeats the purpose of dynamically generating it. [cause it] Demands planning since the beginning. Than what's the purpose of dynamically generating it?
***
Yet, like most of the times there are alternatives.
You can do something like:

oElement[oElement.innerText?"innerText":"textContent"]=myVarText

and it should fix it - all across.
My kind regards.

Troy III 272 Posting Pro

The situations:
I have text in a var, that I am assigning to the innerhtml of a 'p' tag . The text has whitespace at the end.

The problem:
The last whitespace isn't rendered, by p tags. IT is ignored.

Is there a tag other than the pre tag, that can render whitespace at the end ?

I know I can use   , but due to the nature of a processing function , I can't use nbsp. 'pre' tag doesn't seem to respect the css width property. SO the only way forward seems to be a mythical tag that would render all whitespaces (beginning,end).

Help ?

Thanks

You have a text and you want to insert it into a P element[?], -good! But you don't want to innerHTML the damn text, -you want to innerText it, like here:

oElement.innerText=myVarText

there you go. A trailing white-space appears!
Have fun.

Troy III 272 Posting Pro

I suspect that FX is reading it from the cashed value.

Troy III 272 Posting Pro

I somehow managed to drop the main line from my feedback and the reason I wrote my last post which was to be stating that \n, \t, \r and similar, are all white-spaces equal to \s.
But wouldn't go into explaining that \s+ will also match double or more inline white-spaces including their combinations appearing successively in your string.

I've added String constructor to it to make sure it is not running on a plain stream of char-tokens which is a possible situation to run into when copying and pasting from text areas or other similar text sources where \n and other family members happen to be represented literally with "\n" and other corresponding escaped characters.

For leading and trailing white-spaces advise the trim() method to be used as a Preparator agent.

The split() method fed with the (/\s+/) RegExp will make sure to return a qualitative Array consisting of bounds only. And since Arrays use a comma-separator syntax for their values, returning a duck typed array into a string representation will contain the required commas on its end-result by default.
This way the join() operation added there would become optional, or unnecessarily redundant; when arg is omitted [its default join char is also a comma],- but it is there for precaution measures since there are cases when array feed may not necessarily undergo a type conversion - and there's no harm keeping it there as an extension, even if you are sure that a …

Troy III 272 Posting Pro

In removeSpaces(), try:

str = str.replace(/\s+|\n/g, ","); // replace space or newline by commas

I don't recognise the onpaste event so can't work out how/when handlePaste() is supposed to work.

Airshow

-you've made yourself a redundant code there double effort at least 4x more expensive.
your regexp is sort of an equivalent of say: /John|J|o|h(...etc)/
which is wrong.

Troy III 272 Posting Pro
str = (/*b.b. Troy III p.a.e.*/String(str).split(/\s+/).join());
Troy III 272 Posting Pro

Many thanks if you are looking at this.

I have a simple order form that allows users to place an order for an item. The form also allows the user to add more items, calling a javascript function that utilizes innerhtml.

Included in each order form, are dates. I am using a jquery calendar to populate the dates.

When the original form is loaded, the calendar works fine, but when I call the function to add items via the innerhtml, the calendar does not work, either on the original form text fields, or the form text fields added by the innerhtml function.

When the form loads for the first time I have, wrapped in a div with id=image_details, 2 form fields, below:

<div><label>Collection Date:</label></div>
<div><input type="text" name="1_colct" id="date" class="required"/></div>
<div><label>Delivery Date:</label></div>
<div><input type="text" name="1_dlvr" id="datea" class="required"/></div>
<div><a href='#' onclick='addInput()'>Add Another Parcel</a></div>

When the form text field is clicked it calls the following jquery to display an interactive calendar

$(function() {
$("#date").datepicker({ showOtherMonths: true });
$("#datea").datepicker({ showOtherMonths: true });
$("#date"+newnumber+"").datepicker({ showOtherMonths: true });
$("#datea"+newnumber+"").datepicker({ showOtherMonths: true });
});

every is fine up to this point

If I select Add Another Parcel, this calls javascript function addInput, below (note I'm using the newnumber variable to prefix name and id to create unique values that will be used later).

function addInput() {	
var number=2;
var newnumber = number+fields;
document.getElementById('image_details').innerHTML += "<div><label>Collection Date:</label></div><div><input type='text' name='"+newnumber+"_colct' id='date"+newnumber"' class='required'/></div><div><label>Delivery Date:</label></div><div><input type='text' name='"+newnumber+"_dlvr' id='datea"+newnumber"' class='required'/></div>";
fields += 1;
}

This is where it all goes wrong.
I cannot call …

Troy III 272 Posting Pro

That's not true, it works perfectly on all browsers -something else you're doing wrong there.
Seriously without " " indeed!
{Of course if you are coding in HTML, (because you obviously are) and not declaring your document as something that it is not, (xhtml for instance).}

In HTML
Element properties do not require string literals for their property values.

Required property values in HTML[5] are tokens.
Attention: if the property value contains characters that are able to break the token into fragments, [a white-space comes to mind] the " " (string literal) can be used, - and is to be used as a guard!

Note: even the " " guard can be broken by certain white-space character.

Therefore the <img src=file:/c:/archivo1.jpg width=500 height=500></'> conforms HTML5 Strict. The part in red is an error.

A more stict location format protocol would be file://c:/filename.ext, this is how you should normally use it even if that's not going to be used in your final product.

Otherwise, -your original code will work locally with no problem if using Chrome or IE*, but you are debugging in Firefox. Therefore specifying the file protocol is required literally and in literal.

Troy III 272 Posting Pro

I have this code:

<html><head><title></title></head><body><form id='formulario' action='index.html' method='post'><label>Ancho </label><input type='text' name='ancho' id='ancho'><br ><label>Alto </label><input type='text' name='alto' id='alto'><br ><label>Izquierda </label><input type='text' name='izquierda'  id='izquierda'><br ><label>Horizontales </label><input type='text' name='horizontal'  id='horizontal'<br ><label>Verticales</label><input type='text' name='vertical' id='vertical'><br  ><label>Crucero </label><input type='text' name='cruzero' id='cruzero'><br ><label>Marco </label><input type='checkbox' name='marco' id='marco'><br ><label><input type='radio' name='RadioGroup1' value='1'  id='piezas'>Piezas</label><br><label><input type='radio' name='RadioGroup1'  value='0' id='medidas'>Medidas</label><br><input type='submit' value='Enviar'></p></form><img src='c:\archivo1.jpg' width='500' height='500'></body></html>

It doesnt work (doesnt show the image) if I save it as a .html file but if I try it in my Java IDE (MyEclipse) perfect...

No sense at all and its driving me nuts.

Anything?

!Your working code here:

<img src=file:/C:/archivo1.jpg>

----------
(-Why?)
*Firefox doesn't recognize file system paths

Troy III 272 Posting Pro

UPDATE
THE GOOD NEWS IS: Firefox has finally taken (a beautiful) and a remarkable step forward in exposing a list of (event) properties on all DOM elements, which in turn makes firebug auto-complete feature very helpful and handy.

The BAD NEWS IS: latest Chrome release has restricted us from enumerating and seeing these properties on all but window object.

Anyway, now-on it is possible to use both given methods [exemplified above] in a cross-browser environment. (With noted restriction in mind, not to forget that this affects the most recent Safari too) therefore the checklist must be stripped at least from two main objects: document and window.

Troy III 272 Posting Pro

!below is the code snippet
This is a multi-use property toggler. In the given example we are toggling a sub property of an element.

e -is the property owner to be targeted;
p - is the property name to be set;
v - is the property value;

henceforward changing the class-name of the property owner instead; - would look like this:

toggleProp(this,"className","newCls")

meaning that the target element can delegate the behavior instruction to some other element, while the event itself can remain bonded to a simple on/off button, i.e.:

toggleProp(reciever,"className","newCls")

Works in all browsers, in all manners except Firefox v(9.0.1) when used on style properties exhibiting a randomly appearing bug already filed at [ Bugzilla@Mozilla – Bug 720129 ], causing the toggle behavior to stop functioning in an toggle-on state.

Troy III 272 Posting Pro

mp4 doesn't work on firefox

Troy III 272 Posting Pro

what browser are you testing this on?

Troy III 272 Posting Pro

Hy,

I need to get the full path of a file trough JS/Prototype and all i get is the name file.
From what I read on the web this is a security issue and it is not allowed.

But still, is there a way?

The question is "where" "which file" "what context" is it a "current file" "objects file source"
What?

Troy III 272 Posting Pro

In theory, it is!
Empirically -it is not.

Because in the end you will realize that any possible solution will get to complicated, and the complexity will exponentially increase the fragility factor as the code maintainability will drop to zero.

Although, I still hope there is or might be (a true to the notion of the word) a >>simple<< solution to it.

The problem is that: as soon as you solve this step, you will see that something else is gone a stray.
The font size perhaps![?]

Troy III 272 Posting Pro

Sorry i didn't read your new request carefully.
But soon you will realize that it is impractical.

Troy III 272 Posting Pro

Forget about scripts - all script event solutions are jerky and ugly
These tasks are possible but they are all imperfect. Even though, a css solution if not perfect - it is at least smother.

I'm giving this solution away because..., because - you'll get a:

Super-fluid Layout [they say it's the most difficult type of layout ever. (That's the main reason there are less than 1% of the kind running out on internet).]

Table-free; using simple DIVs.
Fixed aspect ratio main content
Vertically and Horizontally centered

and a CSS1 (backward )compatible code (I should post it as a code snippet latter, or should have )

So here you are
See what you can do with it

<!doctype html>
<html>
<head>
<title>Super Stretchy</title>

    <style>
       *
	{
	  padding: 0; 
	  margin: 0;
	  vertical-align: middle;
	}
	#lefter, #righter, #inner, #inright, #indisplay
	{
	 display: inline-block; 
	}

	body, #body
	{
	  position: absolute;
	  height: 99.8%;
	  left: 15%;
	  width: 70%;
	  background: #ddd;
	  margin: 0 auto;
	}
	#lefter
	{
	  width: 20%;
	  height: 90%;
	  background: #444;
	}
	#righter
	{
	  width: 80%;
	  height: 90%;
	  background: #aaa;
	  text-align: center;
	}
	#inner
	{
	  width: 0%;
	  height: 100%;
	  background: #555;
	}
	#inright
	{
	  width: 80%;
	  height: 60%;
	  background: #555;
	  position: relative;
	}
	#head, #footer
	{
	  background: #777;
	  height: 5%;
	}
	#indisplay
	{
	  width: 90%;
	  background: yellow;
	  position: relative;
	}
	#cnt, .cnt
	{
	   color: white;
	   width: 100%;
	   height: 100%;
	   position: absolute;
	   z-index: 1;
	}
	#indisplay img
	{
	   width: 100%;
	   margin: auto;
	   position: relative;

	} …
Troy III 272 Posting Pro

Hi all,
I have taken tutorial from net. but i didnt understand one thing correctly
what does this

done:function(f){
            postaction=f || postaction //remember user defined callback functions to be called when images load
        }

and what does || sign mean there.
Thanks for attention!
here is

function preloadimages(arr){
    var newimages=[], loadedimages=0
    var postaction=function(){}
    var arr=(typeof arr!="object")? [arr] : arr
    function imageloadpost(){
        loadedimages++
        if (loadedimages==arr.length){
            postaction(newimages) //call postaction and pass in newimages array as parameter
        }
    }
    for (var i=0; i<arr.length; i++){
        newimages[i]=new Image()
        newimages[i].src=arr[i]
        newimages[i].onload=function(){
            imageloadpost()
        }
        newimages[i].onerror=function(){
            imageloadpost()
        }
    }
    return { //return blank object with done() method
        done:function(f){
            postaction=f || postaction //remember user defined callback functions to be called when images load
        }
    }
}
 
preloadimages(['1.gif', '2.gif', '3.gif']).done(function(images){
 //call back codes, for example:
 alert(images.length) //alerts 3
 alert(images[0].src+" "+images[0].width) //alerts '1.gif 220'
})

some piece of junk you've picked there
yet, this code is using some perverted version of my original "Freeze" variable method. But this is doing something else. (where did you get it from?!)

Its job is to make sure the argument values passed to the function are preserved one way or the other, although in this version they can be altered during recursion steps.

The "||" means (is a js logical) OR

And postaction = f || postaction means: "postaction" to be equal to "f" arg value OR to "postaction" (itself).

Troy III 272 Posting Pro

If you plan to learn scripting any time soon, you should first forget about its wrappers.

var divstoclear = document.getElementsByClassName("subsubmenu"),x;
for(x in divstoclear){divstoclear[x].innerHTML="";

* using innerHTML property here because you don't want empty elements pilling.

Troy III 272 Posting Pro

This code (including the previous one)is authentic HTML5 and it supports video.
So we will be using one.

You will need at least two source files and types. One on mp4 format and the other on flv or whatever flash or shock-wave plugin uses (I wasn't able to find for this demo) so, for a fallback code I've set a completely different file and source, namely from YouTube.

<!doctype html>
<html>
<head>
<title>Fixed Aspect Ratio</title>

    <style>
	#container
	{
	   position: relative;
	   min-width: 300px;
	   max-width: 750px;
	   margin: auto;
	}

	#container img
	{
	   width: 100%;
	   margin: auto;
	   position: relative;
	   display: block;
	}

	.content
	{
	   width: 100%;
	   height: 100%; /*optional in case the poster image has exact aspect ratio*/
	   position: absolute;
	   z-index: 1;
	}
    </style>

</head>
<body>
<div id=container>
   <video class=content controls autobuffer poster=http://i42.tinypic.com/21e18cx.jpg>
     <source src=http://www.kaltura.com/p/243342/sp/24334200/playManifest/entryId/0_c0r624gh/flavorId/0_w3aolq8p/format/url/protocol/http/a.mp4>
     <object class=content>
	<param name=movie value=http://www.youtube.com/v/66TuSJo4dZM?version=3&feature=player_detailpage>
	<param name=allowFullScreen value=true>
      <embed class=content
	src=http://www.youtube.com/v/66TuSJo4dZM?version=3&feature=player_detailpage 
	type="application/x-shockwave-flash" 
	allowfullscreen=true>
     </object>
   </video> <img src=http://i42.tinypic.com/21e18cx.jpg> 
</div>
</body>
</html>

for real old time browsers which don't support the min/max sizing you are using here, -some further tweaks are necessary. But right now there's no need for that.

Troy III 272 Posting Pro

well than you already have the solution waiton there for you to use it:
1. put your swf inside my div #cont; [replace the existing div #cnt with with it]
2. keep the existing id of that div
3. nothing else.

advanced:
Make a capture of some scene from your swf and save it for static display replacing the source of my image with it.
Clients who have flash disabled will at least see the picture of that content. Others will not see a blank box during file load etc.
The rest is cosmetics...

Troy III 272 Posting Pro

why is it so important that this certain DIV preserves aspect ratio, does it hold an image or other type of graphics or other watchable content?
Any adequate solution depends on the content this div holds. So what is it?

Troy III 272 Posting Pro

sorry for my remissness friend.i checked in HTMLPad 2011 for previews.actually your code is working perfect on browsers..thank you very much.

So, what is your problem than?

Troy III 272 Posting Pro

i found a script which works on the image, but i wish instead of image it uses div

<html>
<head>
<title>Image</title>

<script type="text/javascript">

function resizeImage()
{
	var window_height = document.body.clientHeight
	var window_width  = document.body.clientWidth
	var image_width   = document.images[0].width
	var image_height  = document.images[0].height
	var height_ratio  = image_height / window_height
	var width_ratio   = image_width / window_width
	if (height_ratio > width_ratio)
	{
		document.images[0].style.width  = "auto"
		document.images[0].style.height = "100%"
	}
	else
	{
		document.images[0].style.width  = "100%"
		document.images[0].style.height = "auto"
	}
}
</script>

<body onresize="resizeImage()">
<center><img onload="resizeImage()" margin="0" border="0" src="http://www.ozbv.com/uploads/Winnie-the-Pooh.jpg"></center>
</body>


</head>
</html>

I'm not sure as to why that example uses script, but my solution here might just happen to give you the idea.

<!doctype native>
<html>
<head>
<title>Fixed Aspect Ratio</title>

    <style>
	#cont
	{
	   position: relative;
	   width: 80%;
	   margin: auto;
	   background: black;
	}
	#cont img
	{
	   width: 80%;
	   margin: auto;
	   position: relative;
	   display: block;
	 
	}
	#cnt
	{
	   color: white;
	   width: 100%;
	   height: 100%;
	   position: absolute;
	   z-index: 1;
	}
	div p
	{
	   padding:0 15px;
	}
    </style>

</head>
<body>

<div id=cont>
	<div id=cnt><p> content: this behavior doesn't require scripting</div>
	<img src=http://i42.tinypic.com/21e18cx.jpg>
</div>

</body>
</html>
Troy III 272 Posting Pro

The following sets a keydown event, preventing further input when a condition is achieved.

<textarea rows="5" cols="30" onkeydown="return checkLength(this)"></textarea>

<script type="text/javascript">
var maxLength = 30;

function checkLength(elem) {
  if (elem.value.length == maxLength) {
    return false;
  }
  return true;
}
</script>

1. IN the above I don't understand this part: onkeydown="return checkLength(this)" .
2. How does setting onkeydown to false prevent further input into the textarea ?
3. Also can the same be set using addeventlistener() ? If so how ?

Thanks

1.There's no need for the "return" statement on the event assignment value checkLength function has enough of them returns.
2. Assigning 'false' to the value of any 'event' nullifies it.
3. Of course.

Troy III 272 Posting Pro

We all know that this is not a Chrome Bug-Report list. So, we're not here for arguing whether the water is dry or wet.
We don't [and obviously cant] solve browser bugs. In addition, this forum section is not a place where we solve a went south OS installation(s), or (to use the expression) "reformat OS".
JavaScript cant do that.

We are aware that no one is able to solve an ambivalent problem per se, but we might be able to solve an explicit one -the one that says: uncaught error: Illegal token - in case we see what token caused the error - and narrow down the cause of this (not all), but this explicit case of error.

But beyond all - your signature says: "50% of the solution lies in accurately describing the problem!" whereat this isn't one of them...

Cheer up, (papa smurf).

Troy III 272 Posting Pro

you are not meant "to see CSS" and the wrong is your lack of copy-paste skill probably [!]
the code works perfectly in all browsers including the ones that are to be invented in the future.
and
what do you mean "events are not working as you've coded"? how "else" are they supposed to work? the other way around?

Troy III 272 Posting Pro

I got this error while trying to view my websites on Chrome after reformatting my OS (Windows Vista Ultimate 64bit). I noticed I cant view my adsense ads from my laptop, but I can see them on iPad, so it might have something to do with my Google Chrome browser settings. I already enabled Javascript on chrome, closed browser and opened it again, but still cant see the ads... also tried disabling antivirus while viewing it.

Before I reformatted my laptop, I can still see them fine, so I'm not sure what caused it and how I can fix it. Hope to get some help from here.. will be greatly appreciated.. thanks in advance :)

your problem title says "Uncaught SyntaxError: Unexpected token ILLEGAL"
but instead of sending the code of the error line you are telling a 64 bored bits tale and the 7 bluish smurfs.

Troy III 272 Posting Pro
<!doctype native>
<html>
<head>
</head>
<body>
Font Size: <select id=fontSize>
             <option>10pt</option>
             <option>12pt</option>
             <option>14pt</option>
           </select>

Font Family: <select id=fontFamily>
               <option>Arial</option>
               <option>Verdana</option>
               <option>Georgia</option>
             </select>

<div id=myDiv> some div </div>
<textarea id=myTextArea> some text content </textarea>

<script>

fontSize.onchange=fontFamily.onchange=setTarget;
setTarget=[myDiv,myTextArea/*etc*/];

function setTarget(x){
	for(x in setTarget)
		setTarget[x].style[this.id] = this.value;
	}
</script>
</body>
</html>
Troy III 272 Posting Pro

I understand your frustration, but cant debug somebody else's libraries.
Sometimes it gets complicated debugging pages relying on libraries you wrote yourself.

But accessing your site from any other link other than the 404 error related works just fine.

Troy III 272 Posting Pro

can you access the "text_area" at all, 'cause I'm almost sure you aren't being able to do so.

so for a start you'll need to reference your textarea by id explicitly, once again and store that reference in a variable with the same name and see what you get:

agreement_text=document.getElementById("agreement_text");

to make sure you are being able to access it at all.

Do a fast alert(agreement_text.tagName) to see if it returns "textarea"
if it does, -try populating it again, say: agreement_text.value="I'm agree complete"
if it doesn't set the arbitrary value given.
Than you'll need to: agreement_text.style.display=""; before you try again.
You can't manipulate an element that has the display att set to "none"!

Troy III 272 Posting Pro

Yes but what is the problem?
!!!

Troy III 272 Posting Pro

Ok, this is my final tango with this. Below I've listed the code. I'm able to get the value of the url and display it on screen for the current (active tab) in Google Chrome. Now all I have to do is pass that value as a parameter in the URL via JSON. My processing file resides on a our remote server - in php. Everything I've done with respect to this has worked to perfection. However, any attempts to pass the current url or any url as one of the parameters - e.g. ?format=json&url=http://something.com&callback=? - results in nothing. I'm not sure if what I'm doing is wrong or if it is even possible. The important thing to note is that all we are looking to do is pass the url to a remote server for storage, processing etc and send back results. I have everything working but I just can't seem to get the url to pass as a parameter.

<html>
  <head>
    <title>API JSON Test</title>
    <script type="text/javascript"  
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
    <script>
        window.addEventListener("load", windowLoaded, false);
        function windowLoaded() {
          chrome.tabs.getSelected(null, function(tab) {
            document.getElementById('currentLink').innerHTML = tab.url;
          });
        }
    </script>

    <script type="text/javascript">

        $(document).ready(function(){

   var timeService =
       "http://api.ulore.com/api2.php?key=abce&url="+tab.url+"&format=json&callback=?";


    $.getJSON(timeService, function(data) {
    $('#showdata').html("<p>url_results="+data.post.url+"</p>");
              });
        });
    </script>
        <div id="showdata"></div>
</head>
<body>

</body>
</html>

Again, all the JSON works fine when I'm testing other code. Even if I put in a NON-URL value as a parameter for url=..... it throws the appropriate error. However, it will not accept …

Troy III 272 Posting Pro

I am having some trouble with this code. I want have an onclick function on a div and I want to call this function. Only the 'if' section of the code works. If the #about opacity is anything other than 0.47, it still executes the 'if' code, but not the 'else'

function opacityabout() {
		if ($('#about').css("opacity", "0.47")) {
			$('#about').css("opacity", "1");
			$('#home').css("opacity", "0.47");
			$('#right').css("-webkit-transform", "rotate(180deg)");
		}
		else {
			$('#about').css("opacity", "0.47");
			$('#home').css("opacity", "1");
			$('#right').css("-webkit-transform", "rotate(180deg)");
		}
		}

My HTML is set up like this:

<div id="right" onclick="opacityabout()"> </div>

Thanks

Your statement: if ($('#about').css("opacity", "0.47")) { will always return true.
That's because it's a statement not a conditional. It's the same as stating "if(document)"

The "if" clause will only convert your statement into a boolean value, which happens to be true. Therefore your 'else' clause will never execute. You need a get-er, not a set-er, for your conditional.

I never use jQuerry,
so all I can offer is pure JavaScript solution. Which includes my cS reader method:

cS=
/*b.b. Troy III p.a.e.*/
function(e){return getComputedStyle(e,0)||e.currentStyle}

Therein your working conditional would look something like this:

if( cS($('#about')).opacity <= 0.47 ){...
Troy III 272 Posting Pro

Hello ALL..Emmmmm..:-/
Simple Quest.. Is it possible to make the awesome homepage slider/the hover things of Adidas.com using Jquery or maybe Ajax?

I'm really2 like it..

Nope,
http://www.adidas.com
is 99% flash based.

Troy III 272 Posting Pro

Okay so here's my problem: I've made this navigationbar in Adobe Fireworks and I put in the code into my index file. Everything works, when I mouseover it changes color and when I click it changes color but now I want to make links to these buttons. So here's the problem there is allready a link in the buttons code. Here's what it looks like:

How should I make a link for that code :/?

<td>[B]<a href="put_here://where.you.want.to.go.com"[/B] onmouseout="MM_nbGroup('out');" onmouseover="MM_nbGroup('over','navbar_r1_c1_s1','navbar/navbar_r1_c1_s2.gif','navbar/navbar_r1_c1_s3.gif',1);" onclick="MM_nbGroup('down','navbar1','navbar_r1_c1_s1','navbar/navbar_r1_c1_s3.gif',1);"><img name="navbar_r1_c1_s1" src="navbar/navbar_r1_c1_s1.gif" width="128" height="36" border="0" alt="" /></a></td>
Troy III 272 Posting Pro

How do I add a different font type to each of the sting below in JS...

var conf={
	rotors:[
		['Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'],
		['P','O','I','U','Y','T','R','E','W','Q','L','K','J','H','G','F','D','S','A','M','N','B','V','C','X','Z'],
		['Q','A','Z','W','S','X','E','D','C','R','F','V','T','G','B','Y','H','N','U','J','M','I','K','O','L','P'],
		['P','L','O','K','M','I','J','N','U','H','B','Y','G','V','T','F','C','R','D','X','E','S','Z','W','A','Q'],
		['Z','M','X','N','C','B','V','A','L','S','K','D','J','F','H','G','Q','P','W','O','E','I','R','U','T','Y']
		],
	reflector:[['P','L','O','K','M','I','J','N','U','H','B','Y','G'], ['V','T','F','C','R','D','X','E','S','Z','W','A','Q']]
	}

I would like to change font for each seperate string

JavaScript doesn't bother itself with data presentation, you don't need js for that. The element receiving those data will format their font-types accordingly by means of CSS directives attached to it and with no scripting hassle. It's a clean thing.

Troy III 272 Posting Pro

No you don't want that, (not on this thread); -because, it is only vaguely related to this one. Regarding javascript it requires a totally different solution which makes it a completely different question/problem.

Troy III 272 Posting Pro

of course it is
but you don't want a page yelling at you: "- your caps lock is on !" as soon as it opens, -who cares?! Perhaps you came there by accident or got redirected.

-Not even a standalone application will warn you for "all-caps lock" unless you are feeding its encrypted password field. It's simply annoying!
(and what about users who's pass is deliberately in all caps?)

Don't annoy your clients, the password field should, at least be selected, or focused on, before the warning is shown.
Anyway future browsers are planning to have that feature on inputs of type password by default and IE10 supports it already ... no additional coding needed.

Troy III 272 Posting Pro

You may need to ask yourself: "why would I want to (warn or) alert my client that his 'caps lock is on' as soon as he opens the page -even if he might have no intention of filling anything at all there?"

Anyway,

the plain answer is NO.

Troy III 272 Posting Pro
var InfoArray = new Array();
for(i=0;i<5;i++)
{
   InfoArray['name'] = "ABC";
   InfoArray['id'] = "A123";
   j = i+1;
$('#selectorName').after(
"<input type='text' id='txt"+j+"+"onFocus=prePopulate('txt"+j+"','"+InfoArray+"',(!and it all gets messed up)Hello','Hi');>");}

1.
You have a "type mismatch" there - Arrays cant have Named Properties.
But that shouldn't be a problem because Array is an Object to, and all constructed objects can receive named properties, including the obscure and rarely used: Boolean object. -Meaning it is not the cause of failure.

function prePopulate(txtName,myArray,path,msg)
{
   alert(myArray['name']); // Shows me undefined..!!!
   // .....
}

3.
That is namely a Reference Error end result inherited from a preceding chain of errors in a malformed string.
Your "myArray" will not return 'reference error' but 'undefined', because it's a declared argument name, which never received a value. To correct this you need to go back to the cause.

2.
The correct(ed) string in your jQ statement would be:

$('#selectorName').after(
"<input type=text id=txt"+j+" onFocus=prePopulate(txt"+j+","+InfoArray+",'Hello','Hi')>"
)}

Regards

Troy III 272 Posting Pro
var amount1='12,345,678.10';
var amount2='87,246,125.00';
/* ----------------8<---------------------- */
add=
/*b.b. Troy III p.a.e.*/
function(a,b,s,z){
      a=a.replace(/,/g,'').split('.');
      b=b.replace(/,/g,'').split('.');
//avoiding js floats 
     s=Number(a[0]) + Number(b[0]);
     s+= ((Number(a[1]) + Number(b[1])) / 100).
     toPrecision(2);

z = new String((''+s)./*
	credit: Jeffrey Friedl
	*/replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));

z.numericValue = new Number(s);
return z
}
/* ------------------->8------------------- */
console.log(
      add(amount1,amount2)
)
console.log(
      add(amount1,amount2).numericValue
)
// -------------------------------------- 
//when done using it
delete add;
Troy III 272 Posting Pro

That is perfect, Thanks

Why does it work on FireFox the original way I had it?

have you tried validating your previous html?
do it -and you may find your answer there.

Troy III 272 Posting Pro

Try your code with: <!doctype native> instead of whatever doctype you are using currently
and you're a go!

Troy III 272 Posting Pro

Use: <!doctype native> and
try this -it might even work.

field.onpropertychange=//when perfection comes to play
field.onkeyup=
function(v){this.value=(v=Number(this.value))?v>50?50:v:""};

<input id=field ...> Regards

Troy III 272 Posting Pro

I just read out the code, but didn't find any problems with it.
I'm pretty sure your ajax call is not being served at all.
You may have ran into some sort of a security issue.

Troy III 272 Posting Pro

This little function will do your job

function ifChecked(form){for(x in form.elements)if(form.elements[x].checked)return!0}

"Please select At least [1] Customer"
Asserts and implies that the client is a complete retard or it at least is an ugly redundant overhead for both parties.
Nobody will hit "delete" before deciding what to delete first.

And if one does, nothing will happen logically (the function will cancel the action) and one will say "ups I wanted to delete nothing at all -therefore nothing happened. Good, let me select this one..."