Tuesday, March 14, 2006

JAVASCRIPT: Redirect

I keep having to look this one up, so I posted it here so I could always find it.

<button 
onclick="window.location='http://www.mysite.com/';">


this also works:
<button 
onclick= "window.location.href='http://www.mysite.com/';">

Monday, March 13, 2006

HTML: No dotted line on links

In order to get rid of this dotted lines on links, you write code so link says 'when you click on my and therefore focus the cursor on me, then blur me'

<a href=http://www.google.com 
onFocus="if(this.blur)this.blur()">Google</a>

Saturday, March 04, 2006

C++: Edit The Registry in Borland C++ Builder 5


#include <registry.hpp>//put this line in your header file

void MakeSerKey(String gSerial)
{
TRegistry *Reg = new TRegistry();

Reg->RootKey = HKEY_LOCAL_MACHINE;
if(!Reg->KeyExists("SOFTWARE\\TestSoftware"))
{
if(!Reg->CreateKey("Software\\TestSoftware"))
{
ShowMessage("Can't Create Key","Error",MB_OK);
delete Reg;
return;
}

try
{
if(Reg->OpenKey("Software\\TestSoftware",FALSE))
{
Reg->WriteString("SERIAL",gSerial);
Reg->CloseKey();
}
else
{
ShowMessage("Registry RootDir error");
}
Reg->CloseKey();
}
catch(ERegistryException &E)
{
ShowMessage(E.Message);
delete Reg;
return;
}
}
delete Reg;
}

void UpdateSerKey(String gSerial)
{
TRegistry *Reg = new TRegistry();

Reg->RootKey = HKEY_LOCAL_MACHINE;
if(Reg->KeyExists("SOFTWARE\\TestSoftware"))
{
try
{
if(Reg->OpenKey("Software\\TestSoftware",FALSE))
{
Reg->WriteString("SERIAL",gSerial);
Reg->CloseKey();
}
else
{
ShowMessage("Can't open key.");
}
Reg->CloseKey();
}
catch(ERegistryException &E)
{
ShowMessage(E.Message);
delete Reg;
return;
}
}
delete Reg;
}