try doing:

count=setTimeout("document.getElementById('"+id+"').style.display=display",1000);

... instead. Otherwise, the variable "id" won't be evaluated until the expression is executed (1000 ms later) - and since it's not global, but a function argument, that means it'll be undefined at that time. This way, the variable name is replaced with 'test2' (including start and end singlequotes).

Yeah, it's due to a language array item (['Online']) having been added to langpacks between 1.2 beta and 1.2 final.

3

(300 replies, posted in PunBB 1.2 discussion)

Paul wrote:

Just enter some rubbish xhtml between code tags and the validator will choke.

How so? Since the content between code tags is still escaped with entities, there's no way to actually write malformed xhtml, is there? (i.e. <bad> => <bad>)

4

(300 replies, posted in PunBB 1.2 discussion)

I assume Dr.Jeckyl means the todo list on the first page of this topic wink

Anyway, Dr.J, I think it is smile I for one can't wait - spent some time modifying the 1.1 board to XHTML some time back for the site I'm doing the coding for. Now that the site is beginning to come together, I can't wait to put punBB 1.2 on it, and have both valid XHTML and CSS-based design. The cleanest, fastest, most modern (in terms of standards compliance) board I've seen big_smile Thanks Rickard - and Paul.

5

(1 replies, posted in Programming)

Something like this (not tested):

function HexToInt(Hex: string): integer;
var
  n: integer;
begin
  result:=0;
  // if more than 8 hex digits, the first ones must be 0
  if length(Hex)>8 then
  begin
    for n:=1 to length(Hex)-8 do
    begin
      if Hex[n]<>'0' then
        raise EConvertError.CreateFmt('Hexadecimal value 0x%s out of range',[Hex]);
    end;
  end;
  for n:=1 to length(Hex) do
  begin
    result:=result shl 4;
    case UpCase(Hex[n]) of
      '0' : begin end;
      '1'..'9' : Inc(result,ord(Hex[n])-48); // 1 - 9
      'A'..'F' : Inc(result,ord(Hex[n])-55); // 10 - 15
    else
      raise EConvertError.CreateFmt('Invalid hexadecimal digit: %s',[Hex[n]]);
    end;
  end;
end;

// IntToHex is built in (include SysUtils)

function toHex(s: string): string;
var
  n: integer;
begin
  for n:=1 to length(s) do
  begin
    result:=result+'%'+IntToHex(ord(s[n]),2);
  end;
end;

function toAscii(s: string): string;
var
  n: integer;
begin
  result := '';
  n := 1;
  while n <= length(s) do
  begin
    if s[n]='%' then
    begin
      result:=result+chr(HexToInt(copy(s,n+1,2)));
      Inc(n,2);
    end
    else
      result:=result+s[n];
    Inc(n);
  end;
end;

Obviously, you need to get the values from somewhere (say, a TEdit). The HexToInt function is general purpose - it works for all 32 bit hex values. The toAscii function too - it will allow parts to be unencoded (say, "hel%6Co" = "hello").

toHex converts ALL characters to hex - just like the javascript function - it doesn't care if they could more efficiently be simply plain ascii characters. No idea why the function doesn't use escape(inValue) (or URIescape(inValue)), but I just stuck with what the original function does , since I don't know what you're going to use it for wink. For URL encoding,  it should be tested if the characters are legal, before encoding them. Something like:

function toHex(s: string): string;
var
  n: integer;
begin
  for n:=1 to length(s) do
  begin
    if not (s[n] in ['a'..'z','A'..'Z','0'..'9','-','_','.','!','*',#39,'(',')']) then
      result:=result+'%'+IntToHex(ord(s[n]),2)
    else
      result:=result+s[n];
  end;
end;

You may want to remove all the special characters ('-','_' etc.) from the list above. They're allowed (but not certain to be "safe") in URLs. Also remember that this function should not be used to encode the entire URL with host and path - just for encoding values to be sent via HTTP GET wink But again, don't know if that's what you want it for.