Latest Post
Tampilkan postingan dengan label javascript. Tampilkan semua postingan
Tampilkan postingan dengan label javascript. Tampilkan semua postingan

jsDraw2DX - SVG Graphics Library for JavaScript HTML5

Written By Unknown on Kamis, 24 Oktober 2013 | 09.59

jsDraw2DX is a standalone JavaScript library for creating any type of interactive graphics with SVG (and VML for old IE browsers). Besides the ability to generate all basic shapes like line, rectangle, polygon, circle, ellipse, arc, etc., the library can draw curves, beziers (any degree), function plots, images and decorated text.

To read more about this article Click Here

For Demo Click Here

To download files Click Here

Lightweight jQuery plugin to Create a Preloader - Loadie.js

Written By Unknown on Minggu, 29 September 2013 | 10.46

Loadie.js is a lightweight jQuery plugin to create a preloader that doesn’t suck and that is used by big firms.


To read more about this article Click Here

For Demo Click Here

To download files Click Here

Send and receive data in ajax/jquery

Written By Unknown on Senin, 16 September 2013 | 03.54

How to send and receive data in ajax/jquery 

Sample Ajax tutorial in php



We will need two file for this tutorial ...
1. which send request and receive responce (test.php)
2. which receive request and send response (page.php)

On click of button ..the id of button will be send to page.php

And the response which we will get will replace html content of span id "val" .

test.php

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
    $( ".button" ).on("click",function(){

        $.ajax({
        type:"post",
url: "page.php",
data: {id:$(this).attr('id')},
success: function( data ) {
$( "#val" ).html( "<strong>" + data + "</strong> " );
}
});
        });
});
</script>
</head>
<body>
<button type="button" id="b1" class="button">Button-1</button>
<button type="button" id="b2" class="button">Button-2</button>
<button type="button" id="b3" class="button">Button-3</button>
</br></br></br>
<span id="val" style="background-color:#454282;">Which button is clicked ?<span>

</body>

</html>

---------------------------------------------------------------------------------------------------------------------------
page.php

<?php
$id=$_POST['id'];
if($id=="b1"){
echo "Button 1 is clicked ";
}
if($id=="b2"){
echo "Button 2 is clicked ";
}
if($id=="b3"){
echo "Button 3 is clicked ";
}

?>

Append some (text/img) after some html element using jquery

Written By Unknown on Jumat, 13 September 2013 | 04.56

How to append some (text/img) after some html element using jquery 

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" >
        $(document).ready(function(){
var i=0;
            $("#sub").on("click",function(){
$( "#1" ).append("Test "+i+" ... ");
                 i++;
                 });      
            });
 
        </script>
        </head>
    <body>
<div id="1">This is my test...</div>
<button type="button"  id="sub">Append</button>
</form>
</body>

</html>

Prepend some (text/img) before some html element using jquery

How to prepend some (text/img) before some html element using jquery 

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" >
        $(document).ready(function(){
var i=0;
            $("#sub").on("click",function(){
$( "#1" ).prepend("Test "+i+" ... ");
                 i++;
                 });      
            });
 
        </script>
        </head>
    <body>
<div id="1">This is my test...</div>
<button type="button"  id="sub">Prepend</button>
</form>
</body>

</html>

Written By Unknown on Minggu, 25 Agustus 2013 | 05.42


Scroll to top with jQuery

Written By Unknown on Senin, 19 Agustus 2013 | 22.34


Today I will tell you about scroll to top method.

Earlier it was very difficult and not very fancy like we had used Anchors, I hope you remember.

Anchors are used to enable links to a specific location on a page. Anchor links can be especially useful when navigating between sections of a long document, or when you want to link to a segment of a page instead of the top of the page.

But now days Top Scroll method are more successful. Please see how can we implement it


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Scroll to top</title>
<style type="text/css">
#scroll-to-top {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9999;
display: none;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript" >
</script>
<script type="text/javascript">
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 50) {
$('#scroll-to-top').fadeIn();
} else {
$('#scroll-to-top').fadeOut();
}
});

$('#scroll-to-top a').click(function(){
$('body,html').animate({ scrollTop: 0 }, 600);
return false;
});
});
</script>
</head>

<body>
<div style="height:1000px;">&nbsp;</div>
<div id="scroll-to-top"><a href="#">Top</a></div>
</body>
</html>

You can view the demo on this page. See the link at right bottom.
You can use images for the top link for better user experience.

Detector - PHP and JavaScript based browser and feature detection library

Written By Unknown on Minggu, 07 Juli 2013 | 12.01

Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices & browsers on its own without the need to pull from a central database of browser information.

Detector dynamically creates profiles using a browser’s (mainly) unique user-agent string as a key. Using Modernizr it records the HTML5 & CSS3 features a requesting browser may or may not support. ua-parser-php is used to collect and record any useful information (like OS or device name) the user-agent string may contain.
With Detector a developer can serve the appropriate markup, stylesheets, and JavaScript to a requesting browser without being completely dependent on a front-end-only resource loader nor a browser-detection library being up-to-date.

To read more about this article Click Here

For Demo Click Here 

To download files Click Here

IMCrypt - Image Protection with PHP and JavaScript

Written By Unknown on Jumat, 05 Juli 2013 | 01.23

IMCrypt is an image protection script that basically scrambles and descrambles images you choose on your website so that they can be easily viewed, but not as easily downloaded. This is accomplished by “encrypting” the image one-time on the server side using PHP and “decrypting” it when the client needs it through a piece of Javascript.


To read more about this article Click Here

For Demo Click Here

Flot - JavaScript plotting library for jQuery

Written By Unknown on Minggu, 31 Maret 2013 | 09.51

Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks and interactive features. Just include the Javascript file after you’ve included jQuery.Generally, all browsers that support the HTML5 canvas tag are supported.For support for Internet Explorer < 9, you can use Excanvas, a canvas emulator; this is used in the examples bundled with Flot. 


It’s not working on your development IE 6.0, check that it has support for VML which Excanvas is relying on. It appears that some stripped down versions used for test environments on virtual machines lack the VML support.

To read more about this article Click Here

For Demo Click Here

To download files Click Here

opentip - Open Source JavaScript Tooltip framework

Written By Unknown on Selasa, 26 Februari 2013 | 08.04

Opentip is an open source javascript tooltip based on the protoype framework.
Features:
  • Stems (little pointers)
  • Automatic content download with AJAX
  • Different styles
  • Automatic repositioning of the tooltip if it’s not in the viewport of the browser anymore
  • All kind of triggers (The tooltip can be triggered by mouse over, click, form submit,… everything you can think of really)
  • CSS3 Animations
  • Well tested, with over 200 unit tests
To read more about this article Click Here

For Demo Click Here

To download files Click Here

  

JpGraph - Powerful PHP-driven charts with JavaScript

Written By Unknown on Senin, 12 November 2012 | 07.11

JpGraph is an Object-Oriented Graph creating library for PHP >= 5.1 The library is completely written in PHP and ready to be used in any PHP scripts (both CGI/APXS/CLI versions of PHP are supported).


To read more about this article Click Here

For Demo Click Here

To download files Click Here

Sketch : Draw squiggly sketches in 3D with Hmtl5 and JavaScript

Written By Unknown on Minggu, 30 September 2012 | 10.08

Sketch is a drawing tool with a twist; it allows you to draw in pseudo 3D. Sketches can be saved by users and viewed in a gallery.


The front end is built using the HTML5 canvas element and plenty of JavaScript. Sketches are saved in a MySQL database and PHP is used as a mediator between front end and database.

To read more about this article Click Here 

For Demo Click Here

Audio-Gallery-Suite (A complete audio gallery solution made with HTML5/CSS3/jQuery-JS/C#)

Written By Unknown on Minggu, 26 Agustus 2012 | 10.06

Audio-Gallery-Suite is a complete audio gallery suite/solution that includes a web audio gallery and a software for managing playlists, uploading audios and managing the web audio gallery. The Audio-Gallery-Suite is built up using the latest technology and harnesses their power to put up a sophisticated solution.
 
The Audio-Gallery-Suite is made in a way to be easily setup and deployed by anyone who wishes to use it. I hope that this project proves useful for anyone who intends to use it.
 
Audio-Gallery-Suite is a complete audio gallery solution made with HTML5/CSS3/Jquery-JS/PHP-ajax/C# that includes a web audio gallery and a software for managing the web audio gallery.

To read more about this article Click Here

For Demo Click Here

Adaptive Images with php and javascript

Written By Unknown on Rabu, 22 Februari 2012 | 08.07


Adaptive Images detects your visitor’s screen size and automatically creates, caches, and delivers device appropriate re-scaled versions of your web page’s embeded HTML images. No mark-up changes needed. It is intended for use with Responsive Designs and to be combined with Fluid Image techniques.Features:
  • Works on your existing site
  • Requires no mark-up changes
  • Device agnostic
  • Mobile-first philosophy
  • Easy & powerful customisations
  • Up and running within minutes
To know more details about this, Please CLICK HERE

How to Reload iFrame – Works in FF, Crome, IE, Safari

Written By Unknown on Selasa, 27 Desember 2011 | 08.28


I was working with one web application and I placed a iFrame in it. I am making ajax call and updating iFrame files. Now I want to refresh only iFrame. I found many solution via Google and I tried many with my own idea to replace iFrame or load iFrame etc etc. 


But none of them works in all browsers including IE. Some of them are working in FF, some of them in other browsers. I was looking for a solution which works in all browsers. Finally I found the one which works in all browsers.

Works in FF, IE, Crome, Safari :

document.getElementById("ifr").contentWindow.location.reload(true);

Not Working :

document.getElementById("ifr").contentDocument.location.reload(true);

EX:

var fr = document.getElementById("ifr");
if(fr!=null) 
document.getElementById("previewiframe").removeChild(fr);
var iframehtml = '<iframe id="ifr" src="demo/index.php" width="300px" height="453px" style="z-index:-1;margin:auto;text-align:center; padding: 0 0 0 20px; border:none;"></iframe>';
document.getElementById("previewiframe").innerHTML = iframehtml;

Just changing contentDocument.location.reload() to contentWindow.location.reload() works fine in all browsers. It has problem in IE. iFrame reload was not working in IE but with the first code, it works in IE also. IE iFrame reloads resolved.

Get all links of a webpage with bookmarklet

Written By Unknown on Sabtu, 03 Desember 2011 | 03.57

Hello friends. Want to get all the links of a webpage. Here you are at right place. A simple javascript bookmarklet can do this stuff.

You only have to follow these simple steps.

1. Create an Html file with following code.
2. Run this file and create a bookmarklet.
3. Open the webpage which you want to get the links.
4. Just click your bookmarklet.

You will see all the links of that webpage displayed infront of you.

Thats it. Thanks !!

  <a href='javascript:loc=location.href;
title=document.title;
x=document.getElementsByTagName("A");

y=window.open();
y.document.write("<html><body><h3>Links: "+loc+"</h3>\n");

for(n=0;n<x.length;n++){

if(x[n].href!=""){
if(x[n].text.replace(/\s+/,"").length<1){
for(j=0;j<x[n].childNodes.length;j++) {
if(x[n].childNodes[j].nodeName=="IMG"){
y.document.write(""); break;
}
}
}else{
y.document.write(" "+x[n].href+"<br>");
}
}
}
y.document.write("</body></html>");
y.document.close();void(0);'>Get Links</a>

Clear form elements with jquery

Written By Unknown on Sabtu, 01 Oktober 2011 | 04.45

Hello friends. Here is the code to clear form elements. You need to pass only the form ID in the function and thats all. The form would be cleared. Thanks !!

The Javascript

<script src="https://ajax.googleapis.com/ajax/libs/
jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
function clear_form(form) {
$('#'+form).find(':input').each(function() {
switch(this.type) {
case 'text':
case 'password':
case 'textarea':
case 'select-one':
case 'select-multiple':
$(this).val('');
break;
case 'radio':
case 'checkbox':
this.checked = false;
}
});
}
</script>


Html form

<form id="myForm" name="myForm" method="post" action="">
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td>Gender</td>
<td><input name="sex" type="radio" value="m" />
Male
<input name="sex" type="radio" value="f" />
Female</td>
</tr>
<tr>
<td>I like</td>
<td><input name="like" type="checkbox" value="cricket" />
Cricket
<input name="like" type="checkbox" value="football" />
Football</td>
</tr>
<tr>
<td>Name</td>
<td><input name="name" type="text" /></td>
</tr>
<tr>
<td>Country</td>
<td><select name="select" id="select" >
<option value="">Select Country</option>
<option value="australia">Australia</option>
<option value="canada">Canada</option>
<option value="india">India</option>
<option value="uk">Uk</option>
<option value="usa">USA</option>
</select></td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address"></textarea></td>
</tr>
</table>
</form>
<input type="button" value="Clear" onclick="clear_form('myForm')" />


The Example
 

Gender Male Female
I like Cricket Football
Name
Country
Address

Textarea counter with javascript

Written By Unknown on Sabtu, 20 Agustus 2011 | 01.37

Hello friends. Here is a simple script to count characters of a textarea.

The Javascript

<script type="text/javascript">
function counter(txtfield,countfield,maxlimit) {
if (txtfield.value.length > maxlimit)
txtfield.value=txtfield.value.substring(0,maxlimit);
else
countfield.value = maxlimit - txtfield.value.length;
}
</script>


The Html Form
 
<form name="counterForm">
<textarea name="msg" onKeyUp="counter(this,charLeft,50)">
</textarea>
Characters Left =
<input readonly="readonly" type="text" name="charLeft"
size="4" maxlength="4" value="50" style="border:0" >
</form>


The Example
 


Characters Left =

Simple tabs with jquery

Written By Unknown on Senin, 20 Juni 2011 | 03.22

Hello friends. Here is the code for simple tabs. Fully customizable script. Add as many tabs as you want. Just copy and paste this code into your html.
The css


<style type="text/css">
#box {
width: 289px;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
#tabs {
height: 20px;
}
.myTab {
height: 20px;
width: 70px;
float: left;
cursor: pointer;
text-align: center;
background-color: #dddddd;
margin: 0 1px 0 1px;
padding-top: 5px;
-moz-border-radius: 6px 6px 0px 0px;
-webkit-border-radius: 6px 6px 0px 0px;
border-radius: 6px 6px 0px 0px;
}
.active {
color: #FFFFFF;
background-color: #ee6a6a;
}
#contents {
background-color: #6cc7d8;
height: 145px;
padding: 10px;
margin-top: 5px;
}
</style>

The Html


<div id="box">
<div id="tabs">
<div class="myTab active" id="tab1">Tab 1</div>
<div class="myTab" id="tab2">Tab 2</div>
<div class="myTab" id="tab3">Tab 3</div>
<div class="myTab" id="tab4">Tab 4</div>
</div>
<div id="contents">
<div class="myContant" id="tab1Contents"> 1 1 1 1 1 1 1 1 1 1 1 1 1</div>
<div class="myContant" id="tab2Contents" style="display:none;"> 2 2</div>
<div class="myContant" id="tab3Contents" style="display:none;"> 3 3</div>
<div class="myContant" id="tab4Contents" style="display:none;"> 4 4</div>
</div>
</div>

The javascript


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".myTab").click(function(){
var tab=$(this).attr('id');
$('.myContant').hide();
$('#'+tab+'Contents').show();
$('.myTab').removeClass('active');
$('#'+tab).addClass('active');
});
});
</script>

The Example demo

Tab 1
Tab 2
Tab 3
Tab 4
1 1 1 1 1 1 1 1 1 1 1 1 1
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger