Monday 24 October 2011

javascript for conformation on deleting


<script LANGUAGE="JavaScript">
<!--
function confirmSubmit(ttt,id) {
var msg = "Are you sure you want to delete the data ? " + ttt + " - ID= "+id;
var agree=confirm(msg);
if (agree)
return true ;
else
return false ;
}
// -->
</script>



<td><a onClick="return confirmSubmit('<?php echo $row['id']; ?>','<?php echo $row['name']; ?>')" href="delete.php?id=<?php echo $row['id']; ?>"><strong>Delete</strong></a></td>

Wednesday 14 September 2011

get image upload path for joomla

$folderpath = JPATH_SITE.DS.'components' . DS . 'com_virtuemart' . DS . 'shop_image'. DS .'product/';Barefoot: A Novel

Thursday 8 September 2011

inner join on more then two tables in php


select k2.id, k2.title, k2.extra_fields from jos_k2_items as k2
INNER JOIN jos_vm_order_item as oitem ON oitem.order_item_name=k2.title
INNER JOIN jos_vm_orders as orders ON orders.order_id=oitem.order_item_id
where orders.user_id=62

Tuesday 30 August 2011

show and hide dynamic div by jquery



  <script>
  $(function () {
    $("a").click(function () {
        var ID = this.id;
        $('.'+ID).toggle();
    });
});

</script>









<?php
$j=0;
while($j<=10)
{
?><p>
 <a href="javascript:void(0);" id="content<?php echo $j; ?>"  class="team-readmore">read more.</a>
</p>
</div>
<div class="content<?php echo $j; ?>"  style="display:none"><?php echo stripslashes($getdata[$j][7]); ?></div>
<?php
$j++;
}
?>

Friday 26 August 2011

javascript for detect browser


<script language="javascript" type="text/javascript">
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName  = navigator.appName;
var fullVersion  = ''+parseFloat(navigator.appVersion);
var majorVersion = parseInt(navigator.appVersion,10);
var nameOffset,verOffset,ix;

// In Opera, the true version is after "Opera" or after "Version"
if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
 browserName = "Opera";
 fullVersion = nAgt.substring(verOffset+6);
 if ((verOffset=nAgt.indexOf("Version"))!=-1)
   fullVersion = nAgt.substring(verOffset+8);
}
// In MSIE, the true version is after "MSIE" in userAgent
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
 browserName = "Microsoft Internet Explorer";
 fullVersion = nAgt.substring(verOffset+5);
}
// In Chrome, the true version is after "Chrome"
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
 browserName = "Chrome";
 fullVersion = nAgt.substring(verOffset+7);
}
// In Safari, the true version is after "Safari" or after "Version"
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
 browserName = "Safari";
 fullVersion = nAgt.substring(verOffset+7);
 if ((verOffset=nAgt.indexOf("Version"))!=-1)
   fullVersion = nAgt.substring(verOffset+8);
}
// In Firefox, the true version is after "Firefox"
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
 browserName = "Firefox";
 fullVersion = nAgt.substring(verOffset+8);
}
// In most other browsers, "name/version" is at the end of userAgent
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) )
{
 browserName = nAgt.substring(nameOffset,verOffset);
 fullVersion = nAgt.substring(verOffset+1);
 if (browserName.toLowerCase()==browserName.toUpperCase()) {
  browserName = navigator.appName;
 }
}
// trim the fullVersion string at semicolon/space if present
if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix);
if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix);

majorVersion = parseInt(''+fullVersion,10);
if (isNaN(majorVersion)) {
 fullVersion  = ''+parseFloat(navigator.appVersion);
 majorVersion = parseInt(navigator.appVersion,10);
}

//document.write('Browser name  = '+browserName+'<br>');
alert(browserName);
</script> Hurricanes in Paradise

Friday 19 August 2011

Jquery for ajex or jquery for redirecting page


function change_service(obj)
{
jQuery.ajax({
type: "GET",
url: "index.php?option=com_vmcheck&view=default",
data: "&id="+obj,
success: function(html){
jQuery("#circles").html(html);
}
});
}




 <select tabindex="50" name="s_provider" id="s_provider"  onchange="change_service(this.value);">
      <option>Select Service Provider</option>
      <option value="3">Airtel </option>
      <option value="Vodafone">Vodafone</option>
      <option value="Trump">Trump-MTNL-Mumbai</option>
      <option value="1">Reliance (CDMA)</option>
</select>The Help

Wednesday 10 August 2011

onclick multiple file uploading button,dynamically add uploading buttons


<script>
var i=6;
function generateRow1() {
if(i>35)
{
alert("no more files are upload");
}
else{
var d=document.getElementById("div1");
d.innerHTML+="<p><input type='file' name='foods"+i+"' size='6'>";
i++;
return false;
}
return true;
}
</script>
<input type="file" checks="min=1" size="6" id="fld_photo" class="hide" name="fld_photo">
<div id="div"></div>

Wednesday 3 August 2011

select a field which contain multiple value .....,,,,,,mysql query for searching a field that contain multiple value seprated by comma

id    name    colors
1     kapil     1,2,3
2     mohit    2,1
3     deepak  1,3


select * from shirts where find_in_set('1',colors) <> 0

jquery for refreshing only div content

<script>
jQuery(document).ready(function(){
  jQuery("#amot").change(function() {
  //var file_name="components/com_virtuemart/themes/default/templates/common/shopIndex.tpl.php";
jQuery("#coupon-box").load("index.php #coupon-box")
return false;
});
});
</script>

Friday 29 July 2011

check database for array of values.

example:UPDATE tableName SET someColumn = "updated" WHERE id IN(1, 88, 99, 152)

so it can be done by



for($i = 0; $i < count($arrayOfIDs) $i++)
{
if($i == 0)
$concatenatedIDs .= $arrayOfIDs[$i];
else
$concatenatedIDs .= ',' . $arrayOfIDs[$i];
}

$query = 'UPDATE tableName SET someColumn = "updated" WHERE id IN(' . $concatenatedIDs . ')';


Tuesday 26 July 2011

stop web pages from refreshing or disable menu bar and status bar and tool bar in browser and disable right click

hello frnds
basically refreshing is depend on browser
so one cant say that, that code stop browsers from refreshing

here is the code

/////////////////////first file


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">

function getWin(url,winName,w,h,top,left){
//you can change the status of these variables by punting yes
var newWin = window.open(url,winName,'menubar=no,statusbar=no,location=no,directories=no,width='+w+',height='+h+ ',top='+((screen.height-h)/5)+',left='+((screen.width-w)/2.1));
newWin.focus();
}

</script>
</head>

<body>
<a href="javascript:getWin('stoprefresh.php','win1','500','350','top','left');void(0);">Open</a>

</body>
</html>




////////////////////////////////////stoprefresh.php


<script type="text/javascript">
function showKeyCode(e)
{
/*alert("Inside function showKeyCode(e)");
*/var keycode =(window.event) ? event.keyCode : e.keyCode;

if(keycode == 116)
{
event.keyCode = 0;
event.returnValue = false;
return false;
window.document.statusbar.enable = false;
}
}
</script>

With Body section

<body  onKeyDown ="showKeyCode();" oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
</body>



this is the whole code
which run exactly on CROME
and IE


Friday 22 July 2011

increasing date or how to get next date to current date or date in loop

for applying date in a loop
you have to increasing date according to your condition.
so there is a way

       $date = date ("Y-m-d", strtotime ("+1 day", strtotime($date)));

difference b/w html and html5


HTML5 has several goals which differentiate it from HTML4.
The primary one is consistent, defined error handling. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into a valid document. The problem is that the rules for doing this aren't written down anywhere. When a new browser vendor wants to enter the market, they just have to test malformed documents in various browsers (especially IE) and reverse-engineer their error handling. If they don't, then many pages won't display correctly (estimates place roughly 90% of pages on the net as being at least somewhat malformed).
So, HTML5 is attempting to discover and codify this error handling, so that browser developers can all standardize and greatly reduce the time and money required to display things consistently. As well, long in the future after HTML has died as a document format, historians may still want to read our documents, and having a completely defined parsing algorithm will greatly aid this.
The secondary goal of HTML5 is to develop the ability of the browser to be an application platform, via HTML, CSS, and Javascript. Many elements have been added directly to the language that are currently (in HTML4) Flash or JS-based hacks, such as <canvas>, <video>, and <audio>. Useful things such as Local Storage (a js-accessible browser-builtin sql database, for storing information beyond what cookies can hold), new input types such as date for which the browser can expose easy user interface (so that we don't have to use our js-based calendar date-pickers), and browser-supported form validation will make developing web applications much simpler for the developers, and make them much faster for the users (since many things will be supported natively, rather than hacked in via javascript).
There are many other smaller efforts taking place in HTML5, such as better-defined semantic roles for existing elements (<strong> and <em> now actually mean something different, and even <b> and <i> have vague semantics that should work well when parsing legacy documents) and adding new elements with useful semantics - <article>, <section>, <header>, <aside>, and <nav> should replace the majority of <div>s used on a web page, making your pages a bit more semantic, but more importantly, easier to read. No more painful scanning to see just what that random </div> is closing - instead you'll have an obvious </header>, or </article>, making the structure of your document much more intuitive.

Thursday 30 June 2011

validation of number in javascript

function check_number()
{
var number=document.getElementById("mobileno").value;

if(isNaN(number))
{
alert("number only");

return false;
}
else
{
return true;
}
}

online streaming,cctv in php

WOWZA is a server that is use for live steaming 

Wednesday 29 June 2011

finding mac address

<?php
/*
* Getting MAC Address using PHP
*Kapil sharma
*/
ob_start(); // Turn on output buffering
system(‘ipconfig /all’); //Execute external program to display output
$mycom=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean (erase) the output buffer
$findme = “Physical”;
$pmac = strpos($mycom, $findme); // Find the position of Physical text
$mac=substr($mycom,($pmac+36),17); // Get Physical Address
echo $mac;
?>

HELLO

Hi Frnds,
thats my first artical on my blog.
on my blog u can share Your thoughts about Different kind of technologies and poetry.


With Regards
Kapil Sharma