![]() |
| http://www.99lime.com/ |
Tips for using html and css in easy way : go to -------->http://www.99lime.com/ goto---------->HTML kick Start download--->from github And call the particular class files mentioned in tutorial..
![]() |
| http://www.99lime.com/ |
Tips for using html and css in easy way : go to -------->http://www.99lime.com/ goto---------->HTML kick Start download--->from github And call the particular class files mentioned in tutorial..
<script>
function printDiv(id)
{
var divToPrint=document.getElementById(id);
newWin=window.open('', '', 'left=5,top=10,width=1024,height=768,toolbar=0,scrollbars=0,status=0');
var str='<html><head><link href="css/css.css" rel="stylesheet" type="text/css"/></head><body><div align="center"><img src="image/logo.png" border="0"></div><br/><div align="center"><b>Outstanding Report</b></div><br></body></html>';
newWin.document.write(str);
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();
}
</script>
<input type="image" onClick="return printDiv('sprint');" value="print" src="image/printj.png" class="flrt" title="print report"/>
<div id="sprint">
<?php
// Dynamic Code here
?>
</div>
Expected Output:<script>
$(document).ready(function () {
var showChar = 100;
var ellipsestext = "...";
var moretext = "more";
var lesstext = "less";
var txtlen = 1;
$('.more').each(function () {
var content = $(this).html();
if (content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar - 1, content.length - showChar);
var html = c + '<span class="moreelipses">' + ellipsestext + '</span> <span class="morecontent"><span>' + h + '</span> <a href="" class="morelink" id=testimonial' + txtlen + '>' + moretext + '</a></span>';
$(this).html(html);
}
txtlen++;
});
$(".morelink").click(function () {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
for (var i = 1; i < txtlen; i++) {
if ($("a#testimonial" + i).attr('class') == "morelink less")
{
$("a#testimonial" + i).trigger("click");
}
}
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});
</script>
<div class="comment more">
<?php
//give dynamic code
?>
</div>
<div class="comment more">
<?php
//give dynamic code
?>
</div>
<?php
include 'class.php';
$db=new database();
$db->connect();
?>
<link rel="stylesheet" href="wall.css" type="text/css" />
<script type="text/javascript" src="jquery-latest.js"></script>
<script>
$(document).ready(function() {
$('#textpost').click(function() {
var b=$("#fbpost").val();
var dataString = 'fbwall='+b;
$.ajax( {
type:"POST",
async: false,
url:"ajax.php",
data: dataString,
success: function(data) {
$("#fbpost").val("");
$("#viewpost").html(data);
}
});
});
});
</script>
<div id="container">
<div>
<img src="facebook-logo.jpg" width="200" height="75"/>
</div>
<div id="post">
<form action="" method="post">
<p class="example-twitter">
<textarea name="fbwall" id="fbpost" class="" placeholder="whatzz upp?" >
</textarea>
<br/> <br/>
<a href="#" class="button postfb" id="textpost">Post</a>
</p>
</form>
</div>
<br><br><br><br>
<div id="viewpost">
<?
$queyr=$db->query("select * from fb ORDER BY `id` DESC");
while($query=$db->fetch($queyr))
{
?>
<div id="display">
<div id="leftdisplay">
<img src="http://lh3.googleusercontent.com/-Iw_xOyvn0z0/AAAAAAAAAAI/AAAAAAAAAFw/r_0QqjeH2vQ/s512-c/photo.jpg" width="120" height="120"/>
</div><br/><br/>
<div id="rightdisplay">
<p class="triangle-border left">
<? echo $query["wallpost"];?>
</p>
</div>
</div>
<div style="height:200px;"></div>
<? } ?>
</div>
</div>
<?
include 'class.php';
$db=new database();
$db->connect();
if(isset($_REQUEST["fbwall"]))
{
$wall=$_REQUEST["fbwall"];
$insert=$db->query("INSERT INTO fb (wallpost) VALUES ('$wall')");
if($insert)
{
$select=$db->query("select * from fb ORDER BY `id` DESC");
while($view=$db->fetch($select))
{?>
<div id="display">
<div id="leftdisplay"><img src="http://lh3.googleusercontent.com/-Iw_xOyvn0z0/AAAAAAAAAAI/AAAAAAAAAFw/r_0QqjeH2vQ/s512-c/photo.jpg" width="120" height="120"/></div><br/><br/><br/><br/>
<div id="rightdisplay">
<p class="triangle-border left">
<? echo $view["wallpost"];?>
</p>
</div>
</div>
<div style="height:200px;"></div>
<? }
}
}
?>
Database: id---------->int(11) wallpost--->longtext()
<?
class database
{
public function connect()
{
$con=mysql_connect("localhost","root","") or die("unable to connect");
mysql_select_db("test",$con) or die("unable to select");
}
public function query($sql)
{
$sc=mysql_query($sql) or die("query not working". mysql_error());
return $sc;
}
public function fetch($qu)
{
$ft=mysql_fetch_array($qu);
return $ft;
}
public function num($rows)
{
$rw=mysql_num_rows($rows);
return $rw;
}
}
?>
Output:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Auto Complete Input box</title>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
$("#tag").autocomplete("autocomplete.php", {
selectFirst: true
});
});
</script>
</head>
<body>
<label>Tag:</label>
<form action="" method="post">
<input name="tag" type="text" id="tag" size="20"/>
<input type="submit" value="submit" name="gt"/>
<form>
</body>
<?php
if(isset($_POST["gt"]))
{
$mysql=mysql_connect("localhost","root","123");
mysql_select_db("hi",$mysql);
mysql_query("insert into tag (name) values ('".$_POST["tag"]."')");
echo $_POST["tag"];
}
?>
</html>
autocomplete.php:
<?php $q=$_GET['q']; $my_data=mysql_real_escape_string($q); $mysqli=mysqli_connect('localhost','root','123','hi') or die("Database Error"); $sql="SELECT name FROM tag WHERE name LIKE '%$my_data%' ORDER BY name"; $result = mysqli_query($mysqli,$sql) or die(mysqli_error()); if($result) { while($row=mysqli_fetch_array($result)) { echo $row['name']."\n"; } } ?>Database :
id--->int(4)--->Autocomplete Name--->varchar(50)