Header menu

_________________________________________________________________________________
Showing posts with label basic html. Show all posts
Showing posts with label basic html. Show all posts

Wednesday, 26 February 2014

How to create a link on button tag in html ?


Button with link

Sometimes we need to create link on button in html . To do so we just need to add button tag on text of <a> tag.

In below line of code we have applied <button> tag on text of <a> tag.

<a href="http://www.codesplanet.blogspot.com" target="_parent"><button>Click me !</button></a>

Now we have a button with link on it 

Friday, 13 September 2013

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

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>

Friday, 30 August 2013

Send value of checked checkboxes on next page

<html>
    <body>
<?php
if($_POST){

    echo "<pre>";
    print_r($_POST['test']);
    echo "</pre>";
    }
?>
<form action="#" method="post">
<input type="checkbox" name="test[]"  value="Test1">Test1<br>
<input type="checkbox" name="test[]"  value="Test2">Test2 <br>
<input type="checkbox" name="test[]"  value="Test3">Test3<br>
<input type="checkbox" name="test[]"  value="Test4">Test4 <br>
<input type="submit" name="submit">
</form>
<body>
 <html>

Tuesday, 27 August 2013

Add link in an image in html

<html>
<body>
<div style="border:1px solid; background-color:#EDEDED; height:auto ;width:320px;">
    <div style="background-color:#666683; height:30px ;width:320px;">
        <b><p style=" text-color:#ffffff;align=:center; margin: 0 70;">Web Coding Source </p></b>
        </div>
<a href="http://codesplanet.blogspot.com/"><img border="1px" width="318px" height="250px" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheeCSPKa0IhwYuwA15R6DUhGrpWjnJnITxsfvE6MJcfxLNaJ369tsA8Cp7mdYxbc4Qi_LPDCHt8IKqp0aO_am8w_PimO75QvhKET-ENYCUbOuNkeeGzOaXlsqjzKWkxQBuXICwWNd9vig/s1600/apache-mysql-php-phpmyadmin-300x187.jpg"/></a>
</div>
</body>
</html>

Monday, 26 August 2013

How to disable checkbox set using jquery ?

If you got two set of checkboxes and you have to use one at a time ... then using this code when you click on either of checkbox set .. the other will get disabled..



<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(){
    $( document ).on("click",function(){
        if($("input[name='test[]']:checked").val()){
        $('input:checkbox[name="test_2\[\]"]').attr('disabled', true);
        }
        if($("input[name='test_2[]']:checked").val()){
        $('input:checkbox[name="test\[\]"]').attr('disabled', true);
        }
        });
});
</script>
</head>
<body>


<form id="test_form">
    <b> Checkboxes1</b><br>
<input type="checkbox" name="test[]"   value="Test1">Test1<br>
<input type="checkbox" name="test[]"  value="Test2">Test2 <br>
<input type="checkbox" name="test[]"   value="Test3">Test3<br>
<input type="checkbox" name="test[]"  value="Test4">Test4 <br>
<b> Checkboxes2</b><br>
<input type="checkbox" name="test_2[]"   value="Test1">Test1<br>
<input type="checkbox" name="test_2[]"  value="Test2">Test2 <br>
<input type="checkbox" name="test_2[]"   value="Test3">Test3<br>
<input type="checkbox" name="test_2[]"  value="Test4">Test4 <br>
</form>

</body>
</html>

Sunday, 25 August 2013

How to get value of clicked checkbox using name in 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(){
    $( document ).on("click",function(){
        if($("input[name='test[]']:checked").val()){
        alert($("input[name='test[]']:checked").val());}
        });
});
</script>
</head>
<body>
<b> Checkboxes</b><br>

<form id="test_form">
<input type="checkbox" name="test[]"   value="Test1">Test1<br>
<input type="checkbox" name="test[]"  value="Test2">Test2 <br>
<input type="checkbox" name="test[]"   value="Test3">Test3<br>
<input type="checkbox" name="test[]"  value="Test4">Test4 <br>
</form>

</body>
</html>

Thursday, 22 August 2013

How to add border in html div ?

Notice : solid in border

<html>
    <head>
        <title>
        Form
        </title>
    </head>
    <body>
        <div   align="center" style="border:1px solid ; background-color:#EA2343; height:400; width:700px;margin:0 auto;">
            Test
        </div>
    </body>
</html>

Align html div to center of page

<html>
    <head>
        <title>
        Form
        </title>
    </head>
    <body>
        <div   align="center" style="background-color:#EA2343; height:400; width:700px;margin:0 auto;">
            Test
        </div>
    </body>
</html>

Wednesday, 21 August 2013

How to send an array in url in php ?

File.php  (This file contain array )

<?php

$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'script');

$arr=http_build_query($data);

?>
<a href="nextpage.php?<?php echo $arr; ?>">Sendarray</a>


--------------------------------------------------------------------------------------------------------------------------------

nextpage.php (This file will receive array and print it)


<?php
echo "<pre>";
print_r($_GET);
echo "</pre>";
?>

Tuesday, 20 August 2013

How to write your first php script ?

What you need ?

1. A server
2. A php file to be put in your www. or htdocs directory..

Phpfile

<?php

echo "My first PHP script!";
 

?>