Date : March 29 2020, 07:55 AM
I hope this helps you . You cannot have any comments or any text above your ... remove the comment on top and your site will work fine in IE .. Its currently triggering your page to go into quirks mode (which is roughly equivalent to IE5) .. as far as IE is concerned you have no doctype. Right now you have this comment: <!--Aplicación: Sistema de tickets y pólizas.
Cliente: MA Consulting.
Desarrollador: Edgardo Ramírez León
Twitter: @_soldier
Email: soldiercrp@gmail.com
Fecha: Julio/2012 - Febrero/2013
-->
<!DOCTYPE html>
|
Date : March 29 2020, 07:55 AM
it should still fix some issue As promised i prepared a Demo for you. I put many Remarks in the code to make it easier to understand. Its not using Json but its using an Async funtion to Loop around Local Storage. It works very well. Most of all its very reliable, and never breaks Local storage. You Can Add and delete Users but is open to all sorts of Possibilities, as you will Read from the Remarks. It can Act as a Basic database for Storing data in LocalStore. $( document ).ready(function() {
// an async function to loop around with ease
var asyncFor = function(params) {
var defaults = {
total: 0,
limit: 1,
pause: 10,
context: this
},
options = $.extend(defaults, params),
def = $.Deferred(),
step = 0,
done = 0;
this.loop = function() {
if (done < options.total) {
step = 0;
for (; step < options.limit; step += 1, done += 1) {
def.notifyWith(options.context, [done]);
}
setTimeout.apply(this, [this.loop, options.pause]);
} else {
def.resolveWith(options.context);
}
};
setTimeout.apply(this, [this.loop, options.pause]);
return def;
};
$(document).on( "click", "#sub", function() {
var name = $('#user').val();
var id ="";
//create a random id for the user so we can distinguish him in local storage incase of Possible duplicate first names
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 10; i++ )
id += possible.charAt(Math.floor(Math.random() * possible.length));
//store the data from the form to localstorage. we use user as the kind of dataset so it will enable to store as many datasets as possible. eg stock, places, locations. So you can group data. In this example we are storing Users
localStorage.setItem(id, 'user['+name+'#name]' ); // you can add many form items by seperating them by # eg name#surname#address. I put #name as an example, but in this demo we dont read that. So we call that spare data as it does nothing, although it gets stored for each user.
$('#usersname').html(name);
show_localstore()
});
// get all items from local storage and show them
function show_localstore() {
var mylistitems = "";
$('#storage').empty();
asyncFor({
total: localStorage.length,
context: this
}).progress(function(step) {
var propertyName = localStorage.key(step);
var keyv = propertyName;
var value = localStorage.getItem(propertyName);
//check the dataset if its user. If you have other datasets then change user to that dataset
if (value.indexOf('user') > -1) {
var matches = value.match(/\[(.*?)\]/);
if (matches) {
var words = matches[1];
var match = words.split('#');
var username = match[0]; // matches the first item, if you have many then set up variables and change the match value eg surname = match[1] address = match[2] etc
$("#storage").append('<p><a>user_id='+keyv+'<a>--username='+username+'</a></p>');
}}
}).done(function() {
});
};
//delete localstore item by selecting the User_id value.
$(document).on( "click", "#delsub", function() {
var id = $('#deluser').val();
localStorage.removeItem(id);
show_localstore()
});
show_localstore()
});
|
Date : March 29 2020, 07:55 AM
it fixes the issue I have the following array In php: , Try this ;) $values = [
[
['key'=>"Name",
'value'=>"John"],
['key'=>'Surname',
'value'=>"Doe"],
['key'=>"email",
'value'=>'john@doe.com']
],
[
['key'=>"Surname",
'value'=>"Ichigo"],
['key'=>'Name',
'value'=>"Kurosaki"],
['key'=>'email',
'value'=>'kurosakiighogo@soulsociety.com']
],
[
['key'=>"email",
'value'=>"monket.d@luffy.com"],
['key'=>'Name',
'value'=>"Monkey D."],
['key'=>'Surname',
'value'=>'Luffy']
],
];
$records = [];
$keyIndex = [];
foreach($values as $index=> $record){
$thisRecord = [];
foreach($record as $index1=> $field){
if(!$index){
$keyIndex[$field['key']] = $index1;
$records['head'][] = $field['key'];
}
$thisRecord[$keyIndex[$field['key']]] = $field['value'];
}
ksort($thisRecord);
$records['values'][] = $thisRecord;
}
|
JS: How would I display a decrementing value through an html header? (and more)
Date : March 29 2020, 07:55 AM
I wish this help you The prompt is a blocking event, so you don't see the page update until after the prompts... try the example below, where setTimeout is used to allow a delay... var guesses = 3;
var random = Math.floor((Math.random() * 10) + 1);
//start the guessing
handleGuess(prompt("Pick a number to win the game!"));
function handleGuess(choice) {
guesses--; //subtract one guess
if (guesses > 0) {
if (choice != random) {
document.body.style.backgroundColor = "#CC0000";
var x = "";
x = x + "You have " + guesses + " chances left" + "<br>";
document.getElementById("demo").innerHTML = x;
setTimeout(function() {
handleGuess(prompt("Try again!"));
},1000);//wait 1 second
} else {
var x = "";
x = x + "You win!" + "<br>";
document.getElementById("demo").innerHTML = x;
document.body.style.backgroundColor = "#009000";
//return false;
}
} else {
//running out of turns
var x = "";
x = x + "Game Over!" + "<br>";
document.getElementById("demo").innerHTML = x;
document.body.style.backgroundColor = "#FF0000";
//return false;
}
}
<h1 id="demo">You have 3 chances to guess the correct number.</h1>
<br>
|
How to display an html file between header and footer in PHP and CodeIgniter
Tag : php , By : user183954
Date : March 29 2020, 07:55 AM
wish of those help One of the good things of Codeigniter is that this is quite easy to do and has multiple ways to do it Since it looks like the problem is that the view you need to call is an html file instead of a php file, all you need is to place the html file in your views directory and load it specifiying the filename extension: $this->load->view('layouts/file.html');
|