|
Content slider and play pause buttons are totally different things. You are combining a media player with a content slider.
Do it yourself, using jQuery players[^], and a content slider[^].
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
Then remove the jQuery from search box, and search for JavaScript version. What prevents you from doing so?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Normally JSON data is fetched in the following form from Web API etc.
[
{"name" : "Steve", "Age": 76}, {"name": "Jeremy", "Age": 43}
]
You can see that "name" and "Age" is repeating with every column. But I've seen a service getting data in this fashion. Which really shorten the JSON object something like that.
[
columns: {"name", "age"}
data: {"Steve",76},{"Jeremy",43}
]
How to do it?
|
|
|
|
|
well, you can tweak the Json a little,
{
"name" : ["Steve", "Jeremy"],
"Age": [76,43]
}
looks greatly shortened..
|
|
|
|
|
But you lost all the good in JSON...
I would say that compressing the traffic will do better...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Is there a good tutorial on compressing the traffic on JSON data.
|
|
|
|
|
|
I'm trying to connect the hotel amount with the amount per day. For instance, if you select two days staying at the Economy hotel, it doubles the amount rather than doubling the amount for they the stay at the hotel alone. I've created a variable for days and added it to my if statements to retrieve the value. It was retrieving the amount for a single day correctly, but once I added that variable it began doubling everthing else.
When the user submits their form, a cost estimate for their trip should appear in an alert box with all the options: Quote: Arrival City: Use a radio button. Choices should be Omaha ($200), Nashville ($250), Detroit ($150)
Number of days as a select box with options from 2 through 6
Select box for ‘Extra Baggage ($30 each)’. Options should be ‘No Extra Bags’, ‘1 Extra Bag’, ‘2 Extra Bags’, ‘3 Extra Bags’
Have a checkbox for the following: Bringing a pet ($60)
A radio button to select the type of hotel: Economy Hotel ($140), Standard Hotel ($220), Upscale Hotel ($300)
This what I have so far.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/Javascript">
function arrivalCity ()
{
var cost = 0;
var days;
var radHotel;
days = document.reservation.selDay.value;
if (document.reservation.radCity[0].checked)
{
cost = 200;
}
if (document.reservation.radCity[1].checked )
{
cost = 250;
}
if (document.reservation.radCity[2].checked)
{
cost = 150;
}
if (document.reservation.chkYes.checked)
{
cost = cost + 60;
}
if (document.reservation.radHotel[0].checked)
{
cost = cost + 140;
}
if (document.reservation.radHotel[1].checked)
{
cost = cost + 220;
}
if (document.reservation.radHotel[2].checked)
{
cost = cost + 300;
}
if ( days == "two")
{
cost = cost * 2 ;
}
alert (cost) ;
}
</script>
</head>
<body>
<div id="header">
<form name="reservation">
<p>Where are you traveling to? <br/>
Omaha <input type ="radio" name="radCity"> <br>
Nashville <input type="radio" name="radCity"><br>
Detroit <input type="radio" name="radCity"> </p>
<p>How many days are you staying?<br>
<select name="selDay">
<option value="two"> 2 </option>
<option value="three"> 3 </option>
<option value"four"> 4 </option>
<option value="five"> 5 </option>
<option value="six"> 6 </option>
</select></p>
<p>Extra Baggage ($30 each): <br>
<select name="selBag">
<option value="noBag"> No Extra Bags</option>
<option value="oneBag"> 1 Extra Bag</option>
<option value="twoBag">2 Extra Bags</option>
<option value="threeBag"> 3 Extra Bags</option>
</select> </p>
<p>Bringing a pet ($60):<br>
Yes <input type="checkbox" name="chkYes"><br>
No <input type="checkbox" name="chkNo"> <br> </p>
<p>Select the name of the hotel:<br>
Economy Hotel <input type="radio" name="radHotel" value="$140"><br>
Standard Hotel <input type="radio" name="radHotel" value="$220"><br>
Upscale Hotel <input type="radio" name="radHotel" value="$300"><br>
</select></p>
<p><input type="button" value="Book My Ticket" onclick="arrivalCity ()"> </p>
</body>
</html><pre lang="Javascript">
modified 13-Mar-15 17:19pm.
|
|
|
|
|
<s:url id="sessionExpirePopUp" action="sessionOutCiscoGSS" namespace="">
<s:set name="sessionExpirePopUpNew"
="" value="#sessionExpirePopUp.replace("&","&")">
var timeOutSesVal = 1000 * 60 * 50; // 30 min: session validation time
var timeOutSesExp = 1000 * 60 * 10; // 10 min: session expiry time
var lastActivitySesVal = new Date().getTime();
var lastActivitySesTO;
var reducingTimeSec;
var Min, Sec;
/* Sesion time out and session expiry code starts here */
//below method code is executed until showing sesion validation popup
var checkTimeout;
checkTimeOut = function() {
if (new Date().getTime() > lastActivitySesVal + timeOutSesVal) {
// document.getElementById('icwModalWashout').style.visibility = 'visible';
// document.getElementById('icwModal4').style.visibility = 'visible';
lastActivitySesTO = new Date().getTime();
checkTimeoutSesExp();// this method call is to start expiry timer and show expired message dialog
} else {
window.setTimeout(checkTimeOut, 1000 * 60 * 2); // check 10 per second
}
// }
}
//below method code is executed on click of continue button in first popup
function checkTimeOutAgain() {
lastActivitySesVal = new Date().getTime();
lastActivitySesTO = lastActivitySesVal + 1000 * 60 * 9999;//set some indefinite time to avoid showing session expiry popup
checkTimeOut();
}
//below code is for counter display
function showXMinXSec() {
reducingTimeSec = Math
.floor(((lastActivitySesTO + timeOutSesExp) - new Date()
.getTime()) / 1000);
//calculate minutes and secods
Min = Math.floor(reducingTimeSec / 60);
Sec = reducingTimeSec % 60;
if (Min > 0) {
window.confirm("your data will be lost in " + Min + " Minutes and "
+ Sec + " Seconds. Please save your data");
} else {
window.confirm("your data will be lost in " + Sec
+ " Seconds. Please save your data");
}
}
//below method code is executed for showing next/sesion expiry popup
var checkTimeoutSesExp;
checkTimeoutSesExp = function() {
if (new Date().getTime() > lastActivitySesTO + timeOutSesExp) {
//hide Session Timeout pop up/icwModal4 and enable Session expired/icwModal5 pop up after invalidating session
document.getElementById('icwModal4').style.visibility = 'hidden';
//invalidating session
// $.ajax({
// type: "POST",
// url: '<s:property value="#sessionExpirePopUpNew"/>',
// dataType: "json",
// success: function(){
// document.getElementById('icwModal5').style.visibility = 'visible';
// },
/* error: function(data){
alert('Error in ajax call/response!');
getElementById('icwModalWashout').style.visibility='hidden';
}*/
// });
return false;
} else {
//write logic to show X minutes and X seconds
showXMinXSec();
window.setTimeout(checkTimeoutSesExp, 1000 * 60 * 2); // check 2 min
}
}
|
|
|
|
|
Do you have a question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to make ajavascript wedget code for my website so that it can replace to another website wedget or other place for my website adverting purpose.
|
|
|
|
|
I'd like to have unit testing for my jQuery code. Have gone through some frameworks like Qunit;Jasmine etc. Any suggestions which will be the best suited for JQuery testing automation/unit testing?
|
|
|
|
|
we want to upload a image file and preview to page and save to folder using javascript and c# code
|
|
|
|
|
There are examples online. Are you stuck somewhere?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
If you're talking about ajax functionality for uploading, then please read this post of mine.
Uploading the files – HTML5 and jQuery way![^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I believe you wanted to send this message to OP. Didn't you?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
Here:
<html>
<body>
<input id='input' type='file' onchange='newImage()'/>
<hr>
Preview:
<img id='img'/>
<hr>
<button onclick='downloadImage()'>Download</button>
<script>
var input=document.getElementById('input');
var image=document.getElementById('img');
function newImage(){
if(!input.files||input.value=='') return;
var file=input.files[0];
if(!file.type.match('image.*')){
input.value='';
alert('Images only!');
return;
}
var reader=new FileReader();
reader.readAsDataURL(file);
reader.onload=function(f){
image.src=f.target.result;
}
}
function downloadImage(){
if(!image.src){
alert('There is nothing to download!');
return;
}
var a=document.createElement('a');
a.setAttribute('href',image.src);
a.setAttribute('download','image.png');
a.click();
}
</script>
</body>
</html>
Your welcome
|
|
|
|
|
Need little help with the quiz app
I want to set time limit for each question in quiz module (say 30 seconds) and after that time, the
form will auto submit the question (auto submit = no option selected = unanswered).
There are 3 questions, so total time limit is 90 sec (30 sec each).
How to do that?
I'm doing this via XAMPP.
The link below provide the work so far
https://www.dropbox.com/s/4dzlgjtjzvs48vw/quiz.rar?dl=0
Thanks
|
|
|
|
|
You can use the setTimeout in JavaScript to trigger a function after a time. And once the next question has been loaded, again set the timer so that after exact 30 seconds it would again submit the form.
For example, to submit the form you might run this code,
setTimeout(submitForm, 30000);
function submitForm() {
document.myForm.submit();
}
Doing the same would submit them all. You can set the timeout to re-calculate the time once the question form is loaded again. It would be simple.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
can you please elaborate by putting the code in the correct place
query($query) or die($mysqli->error.__LINE__);
$total = $results->num_rows;
//get a random question
if (empty($_SESSION['questionsUsed']))
{$questionSet = "SELECT * FROM `questions` ORDER BY RAND() LIMIT 1";}
else if ($total>count($_SESSION['questionsUsed'])) //there are more questions that haven't been asked
{
$questionsUsed = implode(',', $_SESSION['questionsUsed']);//join the array
$questionSet = "SELECT * FROM `questions` WHERE question_number not in ($questionsUsed)ORDER BY RAND() LIMIT 1";//get a random question that hasn't already been answered
}
else
{header("Location: final.php");
exit();}
$result = $mysqli->query($questionSet) or die($mysqli->error.__LINE__);
$question = $result->fetch_assoc();
//get random number
$random = $question['question_number'];
$_SESSION['questionsUsed'][] = $random;//add the question number to the list of questions asked
//get choices
$query = "SELECT * FROM `choices`
WHERE question_number = $random";
//get results
$choices = $mysqli->query($query) or die($mysqli->error.__LINE__);
?>
<title>PHP Quizzer
PHP Quizzer
Copyright © Joe
|
|
|
|
|
Hi All,
I have an Unordered List which has many list items, and when we select a li, it opens up two spans, in one of the Span we have have radio buttons, I want to get the baseURL field that is attached to the li that I am selecting so that, can any one please help me any code snippet, link or even suggestion would be helpful. Thanks in advance.
All I want is either to get the report-url attribute or value of the span under the li that is selected or we can say active, I tried in the following ways but couldn't succeed, by the way I have to get these values when I click on the radio button that is within this list item, please help me.
var listitm = $("#li.report active");
var ttl = listitm.find('span.title').toString();
alert(ttl);
<li class="report active">
Enrollment by Child
Lists children with their age, poverty level, IEP status, priority points and first and last days attending class. <br>
<br>This report includes children who have started class and children with an expected start date in the future. The "As of" date version of this report includes children with a pending exit or with an exit on the "As Of" date. The "Cumulative" version of this report includes all children who exited during the reporting period. Children who never attend class are subtracted from this report upon exit or transfer.
<div id="report-parameters" style="position: relative; background-color: rgb(255, 255, 255);">
<div id="parameterList" class="my-container form report-parameters">
<div id="phb_valSummary" class="ValidationSummary" style="display:none;">
</div>
<div id="phb_happySummary" class="SuccessSummary" style="display:none;">
<div class="close" title="Close the saved successfully notification.">x</div>
</div>
<div id="phb_warnSummary" class="WarningSummary" style="display:none;">
</div>
<h2>Report Parameters for Enrollment by Child Report</h2>
<div id="phb_pnlParam_SchoolYear" class="my-section col divider">
<label for="phb_ddlSchoolYear" id="phb_lblSchoolYear" class="req">School Year</label>
</div>
<div class="my-section action-buttons">
<input type="submit" name="ctl00$phb$btnRunReport1" value="Run Report" id="phb_btnRunReport1" style="width: 115px; background-image: url(http://localhost/ELMS/Reports/Image.axd?t=Run+Report&r=0&g=178&b=214&p=20&h=25); background-color: transparent;" />
</div>
</div>
<span style="position: absolute; top: 5px; right: 20px; cursor: pointer;">- Hide Parameters</span>
</div>
</li>
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 24-Feb-15 12:20pm.
|
|
|
|
|
This line:
var listitm = $("#li.report active");
You're referencing "active" as if it's a tag. Add the "." before it, like so: "#li.report.active". You can chain the tag + classes.
Also, to read an attribute, you use jQuery's "attr()" method:
var title = listitm.find("span.title").text();
var url = listitm.find("span.title").attr("report-url");
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
In Javascript document.activeElement will get the currently selected element.Or in the HTML you could add onclick="myFunction(this)".Or onchange="myFunction(this)" to the tag.
|
|
|
|