Friday, April 24, 2009

Tuesday, February 10, 2009

Remove / Hide Scroll Bars

To hide inactive scroll bars set...
overflow: auto;
(When need - will appear)

To hide permanent...
overflow: hidden;

To show...
overflow: scroll;

By this way to hide scroll bar for window use this css...
html, body { overflow: hidden; }


Refer this...
http://www.brunildo.org/test/Overflowxy2.html

Enjoy!

Saturday, January 17, 2009

Getting Radio Button vlaue in PHP

<?php
if(isset($_REQUEST['lang']))
{
$lang=$_REQUEST['lang'];
print($lang);
}
?>
<html>
<head>
<title>TEST</title>
</head>
<body>
<form method="post" action="#">
Please choose language:<br />
<input type="radio" name="lang" value="JAVA">JAVA<br />
<input type="radio" name="lang" value="VB">VB<br />
<input type="radio" name="lang" value="PHP">PHP<br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>

Saturday, January 3, 2009

Disable Right Click using Javascript

Simple way yo disable right click:
<body oncontextmenu="return false;">


Using script:
<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>

From: http://www.reconn.us/content/view/36/45/


Now...
Can i disable right click only on images?
Yes, by using getElementsByTagName i can set no right click on images only

<script>
function noRtClk(){
return false;
}
//document.oncontextmenu = noRtClk;

var e=document.getElementsByTagName("img");
for(var i=0;i<e.length;i++)
{
e[i].oncontextmenu = noRtClk;
}
</script>

Reference: http://www.aglasshalffull.org/css-resources/Using-getElementsByTagName-and-getElementsByName.htm

Thats it.

Thursday, December 11, 2008

meta refresh problem in IE7

<meta equiv="Refresh" content="3;url=http://mysite.com">


this meta tag will redirect to the specified url in 3 seconds.
but it won't work in Internet Explorer 7.

BUT...
we can use a script...

<script language=JavaScript>

function Refresher(t) {
if(t) refresh = setTimeout("document.location='http://www.mysite.com';",
t*1000);
}

</script>

Then call it inside body tag..

<BODY onLoad="Refresher(20)">

Cheers!

Wednesday, December 10, 2008

php explode and implode

Use of Explode and implode functions

Explode - splits a string by a string
eg:
$a = explode("/","23/02/2008");
then
$a[0] = "23"
$a[1] = "02"
$a[2] = "2008"

Implode - joins array elements into string with a string

$b = implode("-",$a);
then
$b = "23-02-2008"


http://in.php.net/manual/en/function.explode.php
http://in.php.net/manual/en/function.implode.php

Getting Last generated auto increment value in mysql

Some tables have auto increment field.

after executing a insert command in mysql, sometimes we may want to know the last added value.... for that we can use
mysql_insert_id()
function

eg:
mysql_query($sql3); //executing some query
$last_num = mysql_insert_id(); //last added value


Cheers!