Comment On WTF Simplicity

Let's take a quick tour of certain programmers' remarkable abilities to take things so simple and turn them into WTF ... [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: WTF Simplicity

2005-06-10 14:35 • by John Smallberries
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}


!= is cooler looking than &&

Re: WTF Simplicity

2005-06-10 14:37 • by spacey
These have to be cases of "Paid by the Hour" versus "Paid by the Line" :)



Why the hell else would anyone have spent so much time being so damn useless......



-space

Re: WTF Simplicity

2005-06-10 14:40 • by whoisfred
36070 in reply to 36068
John Smallberries:
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}


!= is cooler looking than &&




Yeah, cooler and wronger

Re: WTF Simplicity

2005-06-10 14:42 • by rogthefrog
Alex Papadimoulis:

First up, and I must say this one takes the cake, is from Billy. As some background, these constants were defined in every class in the Java project. These were used throughout the system in place of their primitive boolean counterparts ...



public static final String TRUE = "true";

public static final String FALSE = "not true";



They left out a bunch of useful stuff.


Random generator = new Random(123456);


int r = generator.nextInt();


public static String MAYBE = (r % 2 == 0 ? "perhaps" : "who knows");


public static String SOMETIMES = (r % 7 == 0 ? "not bloody likely" : "shit happens");


public static String IDOUBTIT = (r % 31 == 0 ? "shouldn't happen" : "remember the prime directive");


public static String RIIIIIIIIIGHT = (r % 59 == 0 ? "a subspace fracture" : "two to beam up");

Re: WTF Simplicity

2005-06-10 14:43 • by Rich
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))

{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}

This seems to be saying "if you provide a name, you have to provide both a first name and a last name. Not that WTFey, just badly documented.

Re: WTF Simplicity

2005-06-10 14:46 • by Bellinghman
36073 in reply to 36068
"!= is cooler looking than &&"

It's a shame that that's not its meaning though.

(Did nobody test it with both first and last name blank?)

Re: WTF Simplicity

2005-06-10 14:46 • by spacey
36074 in reply to 36071
:P



ROLL ON THE FLOOR @



public static String RIIIIIIIIIGHT = (r % 59 == 0 ? "a subspace fracture" : "two to beam up");



omg rofl



-space

Re: WTF Simplicity

2005-06-10 14:47 • by Doobie Dan
36075 in reply to 36071
rog wins.  You all can go home now.

Re: WTF Simplicity

2005-06-10 14:52 • by rogthefrog
Alex Papadimoulis:

And finally, David Grant shares with this quirky piece of validation code ...



if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))

{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}



I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.


Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.

Re: WTF Simplicity

2005-06-10 15:12 • by DragonMageWTF
36078 in reply to 36073
Bellinghman:
"!= is cooler looking than &&"

It's a shame that that's not its meaning though.

(Did nobody test it with both first and last name blank?)




Or more importantly, with one blank and the other not?

Re: WTF Simplicity

2005-06-10 15:12 • by dubwai
36079 in reply to 36076
rogthefrog:
I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.

Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.


Not that it would be likely, but isn't there the possiblity of an overflow error with that?

Re: WTF Simplicity

2005-06-10 15:13 • by DragonMageWTF
36080 in reply to 36078
Anonymous:
Bellinghman:
"!= is cooler looking than &&"

It's a shame that that's not its meaning though.

(Did nobody test it with both first and last name blank?)




Or more importantly, with one blank and the other not?




or I could be the idiot to not test the proper failing condition...

Re: WTF Simplicity

2005-06-10 15:14 • by dubwai
Alex Papadimoulis:
 


function isNegative( n ) {

return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.

Re: WTF Simplicity

2005-06-10 15:23 • by rogthefrog
36082 in reply to 36079
dubwai:
rogthefrog:
I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.

Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.


Not that it would be likely, but isn't there the possiblity of an overflow error with that?



I like living dangerously.

Re: WTF Simplicity

2005-06-10 15:24 • by rogthefrog
36083 in reply to 36081
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {

return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.



It's a better way than


function isNegative( n ) {
  return n != 0 && n / n == -1
}


or


function isNegative( n ) {
  return n != 0 && Math.abs( n ) / Math.abs( n ) == -1
}

Re: WTF Simplicity

2005-06-10 15:24 • by Charles Nadolski
Alex Papadimoulis:
function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}





The irony here is that the abs() function usually checks for negative
in itself.  So instead of a simple comparison statement, it has
maybe three compares (when including the one from abs()), a function
call, a boolean operation, a negation operation (inside of abs()), and
a division.



At least it doesn't invoke the for-switch paradigm.

Re: WTF Simplicity

2005-06-10 15:28 • by finix
36085 in reply to 36070
whoisfred:
John Smallberries:
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}


!= is cooler looking than &&




Yeah, cooler and wronger


Actually not, considering that != misses only one case while &&
misses two plus won't allow even valid queries ;-) So who's wronger now?



Re: WTF Simplicity

2005-06-10 15:29 • by Stan Rogers
36086 in reply to 36081
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.





Well, it's obvious, isn't it? If the absolute value of a non-zero
number is negative, then the number must belong to the set of numbers
that are Not Ever Gonna Appear Twice In Value Entities. You've just
mistaken the camel-case version of the acronym for the common english
phrase "is negative".

Re: WTF Simplicity

2005-06-10 15:31 • by skicow
36087 in reply to 36081
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {

return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.



Umm...because it looks cooler than:

function isNegative( n ) {

return n < 0
}
[:P]

Re: WTF Simplicity

2005-06-10 15:31 • by Stan Rogers
36088 in reply to 36086
Stan Rogers:
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.





Well, it's obvious, isn't it? If the absolute value of a non-zero
number is negative, then the number must belong to the set of numbers
that are Not Ever Gonna Appear Twice In Value Entities. You've just
mistaken the camel-case version of the acronym for the common english
phrase "is negative".




Nevermind -- old man, bad glasses, small fonts, failed to see the "n/" part. I really gotta adjust this browser.

Re: WTF Simplicity

2005-06-10 15:31 • by finix
36089 in reply to 36085
Getting late.. still, it's two against one

Re: WTF Simplicity

2005-06-10 15:34 • by WebCudgel
Alex Papadimoulis:
function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}





I'll be surprised if they didn't also created isPositive() just to
cover all the bases (and I wonder if a zero would be considered
positive in that respect).

Re: WTF Simplicity

2005-06-10 15:38 • by WebCudgel
Alex Papadimoulis:


public static final String TRUE = "true";
public static final String FALSE = "not true";





Hrm... possibly against his beliefs to call anything "false", he is
forced to say that FALSE = "not true".  After all, if FALSE =
"false" then that would be true and thus a vicious cycle.  FALSE
must be not "true" (to, of course, distinguish from TRUE). 
Therefore, we must define it as FALSE = "not true".

Re: WTF Simplicity

2005-06-10 15:41 • by rogthefrog
36092 in reply to 36090
WebCudgel:
Alex Papadimoulis:

function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}




I'll be surprised if they didn't also created isPositive() just to cover all the bases (and I wonder if a zero would be considered positive in that respect).


There are many ways to deal with that. One simple, elegant way is the following:


function isPositive(n, strict = true)


{


   return (n >= 0 && (strict ? n != 0 : true));


}


Of course it'd be safer to have two separate functions, but I'll leave that as an exercise to the reader.

Re: WTF Simplicity

2005-06-10 15:42 • by WebCudgel
Alex Papadimoulis:


if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}





Yeah, || would be more accurate to use in the place of != (or
&&) there.  However, the developer also fails to check for
the use of "spaces" in addition to it being blank (I knew a QA
department that always tested to see if that was allowed).

Re: WTF Simplicity

2005-06-10 15:44 • by A Wizard A True Star
Alex Papadimoulis:

public static final String TRUE = "true";

public static final String FALSE = "not true";



I don't know Java. Does it really not have a built-in "false" constant?

 

Re: WTF Simplicity

2005-06-10 15:54 • by John Smallberries
36095 in reply to 36085
finix:
whoisfred:
John Smallberries:
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}


!= is cooler looking than &&




Yeah, cooler and wronger


Actually not, considering that != misses only one case while &&
misses two plus won't allow even valid queries ;-) So who's wronger now?




Well, != looks a lot cooler than ||.





Re: WTF Simplicity

2005-06-10 15:55 • by SomeGuy
Alex Papadimoulis:

And finally, David Grant shares with this quirky piece of validation code ...



if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}





So, was nobody going to comment on string compares in Java?

this.txtLastName.Text=="" is not always the same as "".equals(this.txtLastName.Text)



Re: WTF Simplicity

2005-06-10 15:59 • by dubwai
36098 in reply to 36094
A Wizard A True Star:
Alex Papadimoulis:

public static final String TRUE = "true";

public static final String FALSE = "not true";


I don't know Java. Does it really not have a built-in "false" constant?

It has a boolean type that has two values possible values: true and false.  No 0 and 1 or anything like that.

It also has a Boolean Object type that has two constants TRUE and FALSE.  I'm guessing these are supposed to be to evaulate some sort of input, I hope.

Re: WTF Simplicity

2005-06-10 16:02 • by mfx
Alex Papadimoulis:



function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}







Now this is easy to explain. The code is Javascript, which is embedded
in HTML. Early Browsers had Problems with ">" characters embedded in
Javascript, so the programmer tried to avoid both of these "dangerous"
characters.





Still, Math.abs(n) != n would have been more obvious.....

Re: WTF Simplicity

2005-06-10 16:07 • by WebCudgel
36100 in reply to 36096
Anonymous:
Alex Papadimoulis:

And finally, David Grant shares with this quirky piece of validation code ...



if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}





So, was nobody going to comment on string compares in Java?

this.txtLastName.Text=="" is not always the same as "".equals(this.txtLastName.Text)





I had assumed this was a validation JavaSCRIPT for an HTML page, but then it would have been this.txtLastName.value and not .Text.  Hrm... good call there.  It would definitely require .equals().

Re: WTF Simplicity

2005-06-10 16:07 • by Anonymous
36101 in reply to 36099
Anonymous:
Alex Papadimoulis:


function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}



Now this is easy to explain. The code is Javascript, which is embedded in HTML. Early Browsers had Problems with ">" characters embedded in Javascript, so the programmer tried to avoid both of these "dangerous" characters.

Still, Math.abs(n) != n would have been more obvious.....


Finally someone who thinks before writing.

Re: WTF Simplicity

2005-06-10 16:07 • by vDave420
36102 in reply to 36068
John Smallberries:
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}


!= is cooler looking than &&




Except that wouldn't be the same thing...



Consider:

(a==b) != (c==d)



This returns false if either ( (a==b) && (c==d)) or ((a!=b) && (c!=d)), else true



whereas

(a==b)&&(c==d) would return false if only one of them (a,b or c,d) were the same.



In other words, that code is trying to make sure that EITHER none of
the strings is empty OR both are empty.  && (instead of
!=) wouldn't do that.



      -dave-

Re: WTF Simplicity

2005-06-10 16:39 • by RyGuy
36103 in reply to 36082
rogthefrog:
dubwai:
rogthefrog:
I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.

Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.


Not that it would be likely, but isn't there the possiblity of an overflow error with that?



I like living dangerously.



I am not the smartest programmer in the world, but RogtheFrog, in the last WTF you were advocating for the use of delimited strings within a database field and now this.

Re: WTF Simplicity

2005-06-10 16:54 • by Alex
Alex Papadimoulis:

First up, and I must say this one takes the cake, is from Billy.
As some background, these constants were defined in every class in the
Java project. These were used throughout the system in place of their
primitive boolean counterparts ...



public static final String TRUE = "true";
public static final String FALSE = "not true";





The coder here is clearly a postmodernist who feels that there is no
such thing as absolute truth.  By defining the constants this way
(he made a mistake declaring them final, as truth claims cannot ever be
final in the postmodernist viewpoint), he makes it easier for future
developers to define their own truth without making substantial
alterations to the code..

Re: WTF Simplicity

2005-06-10 16:54 • by Jonathan Pryor
36105 in reply to 36096
if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}



Given the naming convention (Hungarian-style prefixes, Pascal-cased property names), this is probably C#, not Java.  In which case this.txtLastName.Text=="" is correct.

Re: WTF Simplicity

2005-06-10 17:04 • by Charles Nadolski
36106 in reply to 36103
RyGuy:
rogthefrog:
dubwai:
rogthefrog:
I've done vaguely similar things
to test whether any of several numerical fields were 0 and flag that
situation.

Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.


Not that it would be likely, but isn't there the possiblity of an overflow error with that?



I like living dangerously.



I am not the smartest programmer in the world, but RogtheFrog, in the last WTF you were advocating for the use of delimited strings within a database field and now this.





Aww, not a fan of the Brute Force Technique?



Also, that first gem not only would risk overflow, but I guarantee that
5 multiplies and a compare will always be slower than just 5 compare
statements ;)

Re: WTF Simplicity

2005-06-10 17:08 • by rogthefrog
36107 in reply to 36103
RyGuy:
rogthefrog:
dubwai:
rogthefrog:
I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.

Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.


Not that it would be likely, but isn't there the possiblity of an overflow error with that?



I like living dangerously.



I am not the smartest programmer in the world, but RogtheFrog, in the last WTF you were advocating for the use of delimited strings within a database field and now this.



I wasn't advocating for the wanton use of delimited strings in a db, nor am I advocating for the wanton use of this shortcut either. Using delimited strings in a db is perfectly legitimate IN SOME VERY SPECIFIC INSTANCES. The a * b * c trick is an example of something I used once in a script I wrote for myself where the variables were controlled. And the "I like living dangerously" was ironic. So nyah.


 

Re: WTF Simplicity

2005-06-10 17:14 • by Matt Moriarity
36108 in reply to 36105
That's what I figured too. Not that I've done much C-Pound :D programming, but I knew it wasn't Java.

Re: WTF Simplicity

2005-06-10 17:36 • by loneprogrammer
36109 in reply to 36081
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.



I figured this is what happens when you let Math majors write
code.  Points off for not including a Proof of Correctness in the
comments.

Re: WTF Simplicity

2005-06-10 17:45 • by Maurits
36110 in reply to 36106
Charles Nadolski:


Also, that first gem not only would risk overflow, but I guarantee that
5 multiplies and a compare will always be slower than just 5 compare
statements ;)




You're neglecting the possibility that the first element is zero.  Those multiplications will scream.

If you HAVE to use abs()...

2005-06-10 17:47 • by Maurits
Alex Papadimoulis:
function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}




    return n != Math.abs(n);

isn't ugly enough?

Re: WTF Simplicity

2005-06-10 18:01 • by Steve Wahl
36114 in reply to 36106
Charles Nadolski:


Also, that first gem not only would risk overflow, but I guarantee that
5 multiplies and a compare will always be slower than just 5 compare
statements ;)




Not necessarily.  Compares represent branches, which can cause
pipline stalls and restarts on modern processors.  And, for
example, x86 comes out with a compare and jump instruction for each
compare, while the multiply version just has a multiply for each
followed by a single compare / jump pair.  That's 10 vs. 7
instructions for five vars.  (Determined by looking at 
compiler (gcc) output for the following C code:)



main(int ac, char **av)

{

    int a, b, c, d, e ;

    int res1 , res2 ;



    a = 16384 ; b = 32768 ;    c = 2 ;    d = 2 ;    e = 2 ;



    res1 = ( (a != 0) && (b != 0) && (c != 0) && (d != 0) && (e != 0) ) ;

    res2 = ( a * b * c * d * e != 0 ) ;



    printf("res1 is %d, res2 is %d\n", res1, res2) ;

}



Which, for me, yields "res1 is 1, res2 is 0" (a 32-bit int machine).



Re: WTF Simplicity

2005-06-10 18:03 • by strongarm
36115 in reply to 36096
Anonymous:
Alex Papadimoulis:

And finally, David Grant shares with this quirky piece of validation code ...



if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))
{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}





So, was nobody going to comment on string compares in Java?

this.txtLastName.Text=="" is not always the same as "".equals(this.txtLastName.Text)



I simply assumed this was written in D flat, you know one of the .NOT languages.

Re: WTF Simplicity

2005-06-10 18:12 • by Steve Wahl
36116 in reply to 36110
Maurits:
Charles Nadolski:


Also, that first gem not only would risk overflow, but I guarantee that
5 multiplies and a compare will always be slower than just 5 compare
statements ;)




You're neglecting the possibility that the first element is zero.  Those multiplications will scream.


Unless I'm quite mistaken, modern processors do integer multiplies in
constant time, independent of the data, so the first element being zero has no effect on speed...



Re: WTF Simplicity

2005-06-10 18:13 • by OneFactor
36117 in reply to 36076
rogthefrog:

I've done vaguely similar things to test whether any of several numerical fields were 0 and flag that situation.


Assume a, b, c, d, e are the fields in question.


bool isValid = (a * b * c * d * e != 0);


Of course I put a comment explaining WTF I was doing that.



Isnt that a little dangerous?


int a = 65536;
Console.WriteLine(a*a);
if (a*a == 0 && a!= 0) {   Console.WriteLine("WTF a*a is zero");   }

Re: WTF Simplicity

2005-06-10 18:15 • by AJR
36118 in reply to 36081
dubwai:
Alex Papadimoulis:
 


function isNegative( n ) {
return n != 0 && n / Math.abs( n ) == -1
}



I'm still waiting on someone to explain why this is good way to check for a negative number.  Don't let me down, people.





Well, it could be worse, they could have done something like this:



function isNegative(n) {


  if n == 0 then {


    if n/Math.abs(n) == -1 then {


      return true


    }

    else {


      return false

    }


  }

  else {


    return false


  }


}



Be thankful for small mercies ;-)


Re: WTF Simplicity

2005-06-10 18:25 • by Rank Amateur
Alex Papadimoulis:

function isNegative( n ) {

return n != 0 && n / Math.abs( n ) == -1
}

Is there anything keeping n from being a float or double? If so, think we got a great heisenbug in here:

n / Math.abs( n ) = -1.00000000000001.

 

And I sure hope Javascript short-circuits the comparison if n is 0. That was tested, right?

Alex Papadimoulis:


if ((this.txtLastName.Text=="")!=(this.txtFirstName.Text==""))

{
boolIsValid = false;
vldSearch.ErrorMessage = "The First and Last names are required to conduct a search.";
}






I wouldn’t want to put the programmer out and make him write a few more lines to determine which field


was empty and have an error message that tells the user exactly what to correct. I myself prefer to


validate a form of numerous fields with a single massive if statement, and throw up the ever helpful error


message “Validation failure on string(s).”  


--RA


Why is this forum SW refusing to wordwrap?

Re: WTF Simplicity

2005-06-10 18:54 • by Andrew McKinlay
I've use code similar to the last quirky validation. It is the shortest
way to do it, but I always worry if other programmers are going to
understand it without a lot of thought. It doesn't get used enough to
become a familar idiom. Usually "short", "simple", and "clear" are compatible, but
in this case maybe not.

Re: WTF Simplicity

2005-06-10 18:59 • by Steven
public static final String TRUE = "true";
public static final String FALSE = "not true";

Actually, this has to be for something other than boolean tests, possibly logging or debugging.
It just wouldn't be for boolean tests, you'd have to work around the fact it was a String everytime you used it!

This just won't work:

if (TRUE)
{

}

It's a string, java won't let you do this, every where you used this, you could do:

public boolean isValid()
{
return TRUE; //Wouldn't work, TRUE is a string
}

so, you'd be doing this:

public String isValid()
{
return true;
}

and then testing:

if (this.isValid().equals(TRUE))
{

}

instead of the much better outcome you get with a true boolean.

if (this.isValid())
{

}


The only reason I can see for it is to do debugging

if (someCondition)
{
Logger.debug(TRUE);
}

But then, you've still defined a constant with the same name as a reserved word ('true' or 'false')

PS, the approach to solving the javascript the the < or > would best be solved with the old fashioned use of
comments inside the script tags so that browsers that didn't get javascript will simply treat the code as comments.

That way, you should be able to use < or > without accidently injecting unexpected html open tag code into the page for the old dumb browsers.

[SCRIPT]
[!--]
your code here
[--]
[/SCRIPT]


« PrevPage 1 | Page 2 | Page 3Next »

Add Comment