In the head of your document, make sure you have
<meta name="viewport" content="width=device-width, initial-scale=1.0">
If you omit this, then many devices will scale the page to fit the viewport.
By Rinky Kandwal

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script language="javascript" type="text/javascript">
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 8;
var randomstring = '';
for (var i=0; i<string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.randform.randomfield.value = randomstring;
}
</script>
Variables to set:
- chars - The random string will be created from these characters.
- string_length - The length of the random string.
Step 2
Use the following code for your text field and button:<form name="randform"> <input type="button" value="Create Random String" onClick="randomString();"> <input type="text" name="randomfield" value=""> </form>

<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to get your position:</p>
<button onclick="getLocation()">Try It</button>
<div id="mapholder"></div>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
var latlon=position.coords.latitude+","+position.coords.longitude;
var img_url="http://maps.googleapis.com/maps/api/staticmap?center="
+latlon+"&zoom=14&size=400x300&sensor=false";
document.getElementById("mapholder").innerHTML="<img src='"+img_url+"'>";
}
function showError(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
x.innerHTML="User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML="Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML="The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML="An unknown error occurred."
break;
}
}
</script>
</body>
</html>
<h1>Contact </h1>
<div id="contact-form">
<form method="post" id="contactform" name="contact">
<label for="comments">Enter your comments or questions here:</label><br />
<textarea name="commentss" id="commentss" rows="3" cols="40"></textarea>
<div class="clearage"></div>
<div id="myrecap" style="overflow:hidden;">
</div>
<div id="contact-response" style="display:inline;"></div>
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</div>
<h1>Rate</h1>
<div id="rate-form">
<form method="post" id="rateform" name="rate">
<div class="clearage"></div>
<br />
<label for="ratecomments">Additional comments:</label><br />
<textarea name="ratecomments" id="ratecomments" rows="3" cols="40"></textarea><br />
<div class="clearage"></div>
<div id="myraterecap" style="width:318px;height:1px;float:left;overflow:hidden;">
</div>
<div id="rate-response" style="display:inline;margin-left:15px;"></div>
<br />
<div class="submit"><input type="submit" name="submit" value="Submit" /></div>
</form>
</div>
<link rel="stylesheet" type="text/css" href="<?php JURI::root()?>css/fb-pagination.css" />
.loading-bar {padding: 10px 20px;display: block;text-align: center;box-shadow: inset 0px -45px 30px -40px rgba(0, 0, 0, 0.05);border-radius: 5px;margin: 20px 0;font-size: 2em;font-family: "museo-sans", sans-serif;border: 1px solid #ddd;margin-right: 1px;font-weight: bold;cursor: pointer;position: relative;}.loading-bar:hover {box-shadow: inset 0px 45px 30px -40px rgba(0, 0, 0, 0.05);}#travel {padding: 10px;background: rgba(0,0,0,0.6);border-bottom: 2px solid rgba(0,0,0,0.2);font-variant: normal;text-decoration: none;}#travel a {font-family: 'Georgia', serif;text-decoration: none;border-bottom: 1px solid #f9f9f9;color: #f9f9f9;font-size: 1.5em;}
<script>(function($) {$.fn.scrollPagination = function(options) {var settings = {nop : 10, // The number of posts per scroll to be loadedoffset : 0, // Initial offset, begins at 0 in this caseerror : 'No More Memories!', // When the user reaches the end this is the message that is// displayed. You can change this if you want.delay : 500, // When you scroll down the posts will load after a delayed amount of time.// This is mainly for usability concerns. You can alter this as you see fitscroll : true // The main bit, if set to false posts will not load as the user scrolls.// but will still load if the user clicks.}// Extend the options so they work with the pluginif(options) {$.extend(settings, options);}// For each so that we keep chainability.return this.each(function() {// Some variables$this = $(this);$settings = settings;var offset = $settings.offset;var busy = false; // Checks if the scroll action is happening// so we don't run it multiple times// Custom messages based on settingsif($settings.scroll == true) $initmessage = 'Scroll for more or click here';else $initmessage = 'Click for more';// Append custom messages and extra UI$this.append('<div class="content"></div><div class="loading-bar">'+$initmessage+'</div>');function getData() {// Post data to ajax.php(ajax or file name where data get)$.post('<?php JURI::root();?>index.php?option=com_listloved&task=ajaxpagination.pagination&lid=<?php echo $_REQUEST['lid'];?>&year=<?php echo $_REQUEST['year'];?>', {action : 'scrollpagination',number : $settings.nop,offset : offset,}, function(data) {// Change loading bar content (it may have been altered)$this.find('.loading-bar').html($initmessage);// If there is no data returned, there are no more posts to be shown. Show errorif(data == "") {$this.find('.loading-bar').html($settings.error);}else {// Offset increasesoffset = offset+$settings.nop;// Append the data to the content div$this.find('.content').append(data);// No longer busy!busy = false;}});}getData(); // Run function initially// If scrolling is enabledif($settings.scroll == true) {// .. and the user is scrolling$(window).scroll(function() {// Check the user is at the bottom of the elementif($(window).scrollTop() + $(window).height() > $this.height() && !busy) {// Now we are working, so busy is truebusy = true;// Tell the user we're loading posts$this.find('.loading-bar').html('Loading Memories');// Run the function to fetch the data inside a delay// This is useful if you have content in a footer you// want the user to see.setTimeout(function() {getData();}, $settings.delay);}});}// Also content can be loaded by clicking the loading bar/$this.find('.loading-bar').click(function() {if(busy == false) {busy = true;getData();}});});}})(jQuery);</script>
// this id where data or rows fetch or show<script>$(document).ready(function() {$('#content').scrollPagination({nop : 10, // The number of posts per scroll to be loadedoffset : 0, // Initial offset, begins at 0 in this caseerror : 'No More Memories!', // When the user reaches the end this is the message that is// displayed. You can change this if you want.delay : 500, // When you scroll down the posts will load after a delayed amount of time.// This is mainly for usability concerns. You can alter this as you see fitscroll : true // The main bit, if set to false posts will not load as the user scrolls.// but will still load if the user clicks.});});</script>
<div id="content"></div>
public function pagination(){$app = JFactory::getApplication();$model = $this->getModel('listloved');$offset = is_numeric($_POST['offset']) ? $_POST['offset'] : die();// it comes by scrolling by default$postnumbers = is_numeric($_POST['number']) ? $_POST['number'] : die();;// it comes by scrolling by default$user = JFactory::getUser();$loggeduserid=$user->id;$lid = base64_decode($_REQUEST['lid']);$lovedone=$model->getsingleLovedone($lid);$row = $lovedone[0];$memoriesdetails=$model->getmemories($lid,$postnumbers,$offset);//echo $memoriesdetails;//$rows = $model->getCemetryByOthers($arr);//print_r($rows);// Now update the loaded data to the database via a function in the model//$num = count($rows);foreach( $memoriesdetails as $memory){?><div class="panel"><div class="img"><img src="<?php echo JURI::root()?>images/user_photos/<?php echo $memory->image;?>" width="40" height="40" alt="" /></div><?php if($memory->userid == $loggeduserid){?><a href="<?php echo JURI::base().'index.php?option=com_listloved&layout=flowerwall&lid='.base64_encode($memory->lid).'&year='.$memory->year.'&memid='.$memory->mem_id;?>"><img src="images/delete.png" alt="" border="0" /></a><?php }?><!--<a href="#"><img src="images/delete.png" alt="" border="0" /></a>--><div class="left"><a href="<?php echo JURI::root();?>index.php?option=com_listloved&layout=senderinfo&id=<?php echo base64_encode($memory->userid);?>" target="_blank"><?php echo $memory->name;?></a> Added Memory To <a href="<?php echo JURI::root();?>index.php?option=com_listloved&layout=lovedone&lid=<?php echo base64_encode($row->lid);?>" target="_blank""><?php echo $row->f_name.' '.$row->l_name;?></a></div><div class="big"><p><?php echo $memory->memories;?></p><?php if($memory->mem_image){ ?><img src="<?php echo JURI::base();?>images/memory/<?php echo $memory->mem_image;?>" alt="" width="498" /><?php}?></div></div><?php }$app->close();return true;}
public function getmemories($lid,$postnumbers,$offset){$db = JFactory::getDBO();$query = $db->getQuery(true);$query="SELECT * FROM #__memories as a INNER JOIN #__users as b ON a.userid = b.id WHERE a.lid = '".$lid."' ORDER BY a.mem_id DESC LIMIT ".$postnumbers." OFFSET ".$offset;//return $query;/*$query->select('*');$query ->from($db->quoteName('#__memories', 'a'));$query ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.userid') . ' = ' . $db->quoteName('b.id') . ')');$query ->where($db->quoteName('a.lid') ." = ".$db->quote($lid));$query->order($db->quoteName('a.mem_id') . ' DESC');$query->setLimit($postnumbers,$offset);*/$db->setQuery($query);$rows = $db->loadObjectList();return $rows;}