 |
 |
<head>
<!-- //In header section of the page add below url code: -->
<!-- Sesion time out and session expiry url starts here -->
<!-- Sesion time out and session expiry url starts here -->
<script type="text/javascript" language="javascript"
src="<%=request.getContextPath() %>/jsp/js/jquery.js"></script>
<script type="text/javascript">
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: '',
// 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
}
}
</script>
</head>
|
|
|
|
 |
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 !~
|
|
|
|
 |
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
//get total questions
$query = "SELECT * FROM `questions`";
//get result
$results = $mysqli->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__);
?>
<html>
<head>
<meta charset="utf-8" />
<title>PHP Quizzer</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<header>
PHP Quizzer
</header>
if(isset($_SESSION['count'])){
$count = $_SESSION['count'];
}else{
$count = 0;
}
?>
Question of
<form method="post" action="process.php">
fetch_assoc()) : ?>
- <input name="choice" type="radio" value="" />
<input type="submit" value="Submit" />
<input type="hidden" name="number" value="" />
</form>
</body>
</html>
|
|
|
|
 |
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">
<span class="title" report-url="/ELMS/Reports/Definitions/EnrollmentByChild.rdl">Enrollment by Child</span>
<span class="description">
Lists children with their age, poverty level, IEP status, priority points and first and last days attending class.
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.</span>
<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.
|
|
|
|
 |
Hi All,
Can anybody let me know if I can hide a button without id or name, I am unable to hide neither the div or button from the following, I have used the below code, can anybody please help me in it.
I have been trying but not successful I am thinking that he was adding this div and close button in one popup and used in another popup, I am not sure how to handle in this situation as this person didn't use name nor id, any type of help, code snippet, any link or even suggestion would be helpful.
<div class="footer" style="position: absolute; bottom: 0px; width: 95%; margin-left: 2%; z-index: 3;">
<button style="width: 80px; background: url(http://localhost/ELMS/Image.axd?t=Close&r=211&g=211&b=211&p=20&h=25) 0% 0% no-repeat transparent;">Close</button>
</div>
<pre>
None of the following code hiding these html controls
<pre>
$('.footer').css('display', 'none');
$('.footer').hide();
$('.no-repeat.transparent;').css('display', 'none');
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 23-Feb-15 2:22am.
|
|
|
|
 |
Why not to add an ID?
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
 |
They are saying they want to run it only with class, if we add ids and if we use same id some where when we write functions or use popups we may get errors. Second this is what they are using here is we don't write jquery in aspx or ascx page but we have files called xx.js, common.js, Popup.js etc there we write all jquery, that is why we are not using ids.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
 |
Sure you can. You can get to any element in the html so long as you know it's position in relation to other elements.
I like to think of this approach as somewhat akin to climbing a tree with your eyes closed. So long as you've looked at the tree first and know where the branches are in relation to one another, you can climb away. It's fraught with danger though, because you can remember the relationships wrong or they can change from when you look at them to when you try to use them.
It may well be a poor analogy - but it works for me.
--
You can take advantage of a function querySelectorAll for this task. It allows you to pass in a string which would serve as a css selector for the element.
In your case, you want to target a button element that's contained in an element with the footer class. The css selector for this would be .footer button
See below for a short demo that allows you to hide/show the target button.
<!DOCTYPE html>
<html>
<head>
<script>
"use strict";
function byId(e){return document.getElementById(e);}
window.addEventListener(
function onDocLoaded()
{
byId(}
function onHideShowBtnClick(e)
{
var tgtBtn = document.querySelectorAll(
// works because the button doesn // if the button had a css rule that set its display attribute to none, this code would fail
// since it doesn if (tgtBtn.style.display == tgtBtn.style.display = else
tgtBtn.style.display = }
</script>
<style>
/* un-comment the below style to see the effect of the comment in onHideShowBtnClick */
/*
.footer button
{
display: none;
}
*/
</style>
</head>
<body>
<div class="footer" style="position: absolute; bottom: 0px; width: 95%; margin-left: 2%; z-index: 3;">
<button style="width: 80px; background: url(http://localhost/ELMS/Image.axd?t=Close&r=211&g=211&b=211&p=20&h=25) 0% 0% no-repeat transparent;">Close</button>
</div>
<hr>
<button id='mHideShowBtn'>Hide/Show</button>
</body>
</html>
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
|
|
|
|
 |
Hi,
I have a js file in which code is written as below, I am not understand some of the statements from here, can you please let me know why and in which contexts we use these statements.
1. ELMS.Constructs.Popup = function (parameters) {
2. jQuery.fn.convertLinkToPopupWithClose =
3. this.containerDiv = $("<div class='container'></div>").css (xxxx...),
I am not use what are these why are we trying to assign them to some values? how, where and when should we use them? Can you please explain them little bit?
if (!ELMS.Constructs) {
ELMS.Constructs = {};
}
ELMS.Constructs.Popup = function (parameters) {
var _that = this;
this.offset = 10;
this.parameters = parameters;
this.displayed = false;
this.waitElement = ELMS.Common.generateWaitDiv("Loading Popup...");
this.outsideContainerDiv = $("<div class=\"popup\"></div>")
.css({
width: "450px",
top: this.parameters.y.toString() + "px",
left: this.parameters.x.toString() + "px",
overflow: "hidden",
paddingRight: "10px",
paddingBottom: "10px",
height: "400px"
});
this.containerDiv = $("<div class='container'></div>")
.css({
position: "relative",
marginTop: this.offset.toString() + "px",
width: "100%",
paddingBottom: "36px",
height: "100%"
})
.appendTo(this.outsideContainerDiv);
//this.iframeContainerDiv = $("<div></div>")
// .css({
// width: "100%"
// })
// .height(this.parameters.height ? this.parameters.height : 400);
$("<div class='handle'></div>").appendTo(this.outsideContainerDiv);
this.createTitle = function (title) {
_that.titleH2 = $("<h2>" + title + "</h2>");
_that.containerDiv.prepend(_that.titleH2);
};
if (this.parameters.title)
this.createTitle(parameters.title);
//this.iframeContainerDiv.appendTo(this.containerDiv);
this.setTitle = function (title) {
if (!this.titleH2)
this.createTitle(title);
else
this.titleH2.text(title);
};
this.iframe = $( .css({
width: "100%",
height: "100%",//(this.parameters.height ? this.parameters.height : 400).toString() + "px",
position: "absolute",
zIndex: 1,
marginTop: "25px",
top: 0
});
this.iframe.appendTo(this.outsideContainerDiv);
this.preClose = function () {
if (_that.parameters.preCloseFunction)
if (!_that.parameters.preCloseFunction(_that))
return false;
return true;
};
this.runningInternalClose = false;
this.internalCloseFunction = function () {
if (_that.runningInternalClose)
return;
_that.runningInternalClose = true;
if (_that.iframe[0].contentWindow && _that.iframe[0].contentWindow.ELMS && _that.iframe[0].contentWindow.ELMS.Common.isDirty)
if (!confirm("There are unsaved changes. Would you like to leave this page? Any unsaved changes will be lost."))
return false;
if (!_that.preClose())
return false;
if (_that.parameters.closeDestroys)
_that.destroy.apply(_that, arguments);
else
_that.hide.apply(_that, arguments);
if (_that.parameters.closeInformsParent) {
var message = { action: "Close" };
if (_that.parameters.closePayload)
message.payload = _that.parameters.closePayload;
_that.sendMessage(message);
}
_that.runningInternalClose = false;
return true;
};
this.upperClose = $("<image alt='Close Popup' border='0' src='" + ELMS.Common.root + "/images/Popup-Close-Button.png' />")
.css(
{
position: "absolute",
border: "none",
fontSize: 0,
backgroundColor: "transparent",
height: "25px",
width: "25px",
right: "0",
top: "0",
cursor: "pointer"
}
)
.click(this.internalCloseFunction)
.appendTo(this.outsideContainerDiv);
if (this.parameters.showFooter) {
this.footer = $("<div class=\"footer\"></div>")
.css({
position: "absolute",
bottom: 0,
width: "95%",
marginLeft: "2%",
zIndex: 3
});
if (this.parameters.showClose) {
if (event.target.toString().match(/[^\/]+$/)[0].toString().split( this.closeButton = $("<button style=\"background:transparent url( ELMS.Common.handleDynamicButtonImages(this.closeButton);
this.closeButton.click(this.internalCloseFunction);
}
}
this.footer.appendTo(this.containerDiv);
}
this.messageCallbacks = [];
this.addMessageCallback = function (callback) {
this.messageCallbacks.push(callback);
return this;
};
var _popup_this = this;
this.sendMessage = function (payload) {
if (payload.action.toLowerCase() == "resize") {
this.resize({ width: payload.payload.width, height: payload.payload.height });
} else if (payload.action.toLowerCase() == "redirect") {
_popup_this.destroy();
ELMS.Common.getTopLevelWindow().ELMS.Common.wait();
ELMS.Common.getTopLevelWindow().location.href = ELMS.Common.resolveUrl(payload.payload.url || payload.payload.redirectUrl);
} else if (_popup_this.messageCallbacks.length == 0 && payload.action.toLowerCase() == "close") {
if (_popup_this.parameters.showClose && _popup_this.closeButton)
_popup_this.internalCloseFunction();
else
_popup_this.destroy();
} else {
for (var i = 0, callback; callback = _popup_this.messageCallbacks[i]; i++) {
callback(_popup_this, payload);
}
$(ELMS.Common.getTopLevelWindow().document).trigger("ELMS:ReceivePopupMessage", [ _popup_this , payload ]);
}
};
this.setPreCloseFunction = function (preCloseFunction) {
this.parameters.preCloseFunction = preCloseFunction;
};
this.show = function (title, element) {
if (element) {
ELMS.Common.dimElementBackground(element);
} else {
ELMS.Common.dimBackground();
}
var div = this.outsideContainerDiv,
body = ELMS.Common.getTopLevelWindow().document.body;
if (div.parent().length > 0) {
div.show();
} else {
if ($.browser.msie && parseInt($.browser.version, 10) <= 8) {
var html = $("html")[0];
if (html.scrollTop > 0)
div.css("top", (25 + html.scrollTop).toString() + "px");
} else {
var bodyScrollTop = document.scrollTop ? document.scrollTop : body.scrollTop;
if (bodyScrollTop > 0)
div.css("top", (25 + bodyScrollTop).toString() + "px");
}
div.appendTo(body);
if (!this.parameters.sourceIframe && !this.parameters.sourceElement && this.parameters.url)
this.iframe.prop("src", this.parameters.url);
if (!this.parameters.sourceIframe)
this.wait();
this.iframe.load(this.iframeLoaded);
if (this.parameters.sourceIframe)
this.iframeLoaded({ target: this.iframe[0] });
div.draggable({ handle: ".handle" });
}
this.displayed = true;
return this;
};
this.dimBackground = function () {
var div = this.outsideContainerDiv,
height = div.height() - this.offset,
width = div.width() + 1;
$("<div class='dimBG'></div>")
.css({
position: "absolute",
top: this.offset.toString() + "px",
left: 0,
height: height.toString() + "px",
width: width.toString() + "px",
background: "transparent url('" + ELMS.Common.root + "/images/Transparent-Bg.png') left top repeat",
zIndex: 3
})
.appendTo(div);
//Disable the upper-right close button -- this technically breaks the boundary of our BG cover, so someone could click it.
this.upperClose.css("cursor", "default").off("click", this.internalCloseFunction);
};
this.undimBackground = function () {
this.outsideContainerDiv.find(".dimBG").remove();
this.upperClose.css("cursor", "pointer").click(this.internalCloseFunction);
};
this.wait = function (message) {
this.outsideContainerDiv.data("oldHeight", this.outsideContainerDiv.height());
this.outsideContainerDiv.height(this.containerDiv.outerHeight() + 10);
this.waitElement.find("p").text(message);
this.dimBackground();
this.waitElement.appendTo(this.containerDiv).center(this.containerDiv);
};
this.unwait = function () {
this.outsideContainerDiv.height(this.outsideContainerDiv.data("oldHeight"));
this.undimBackground();
this.waitElement.remove();
};
this.iframeContentLoaded = function (popup) {
if (popup) {
//ELMS.ActivePopup = popup;
var urlChanged = popup.currentUrl && popup.currentUrl != popup.iframe[0].contentWindow.location.href;
popup.currentUrl = popup.iframe[0].contentWindow.location.href;
if (popup.iframe[0].contentWindow.ELMS)
popup.iframe[0].contentWindow.ELMS.ParentPopup = popup;
$(popup.iframe[0].contentWindow).resize(function () {
if (!popup.resizing)
popup.resize({ basedOnContent: true });
});
if (popup.parameters.showTitle && !popup.parameters.title) {
var text = $(popup.iframe[0].contentDocument).find(".title,h2").first().remove().text();
if (popup.titleH2)
popup.titleH2.text(text);
else
popup.createTitle(text);
}
var actionButtons = $(popup.iframe[0].contentDocument.body).find(".action-buttons");
if (popup.parameters.showFooter && actionButtons.length > 0) {
var clone;
if (urlChanged && popup.parameters.processedActionButtons) {
this.footer.find(".action-buttons").remove();
popup.parameters.processedActionButtons = false;
}
if (popup.parameters.processedActionButtons) {
clone = this.footer.find(".action-buttons").find("button,input[type='submit']").remove();
popup.parameters.processedActionButtons = false;
}
if (!popup.parameters.processedActionButtons) {
popup.parameters.processedActionButtons = true;
clone = actionButtons.clone().css({
float: "left",
margin: 0,
padding: 0,
border: "none",
width: "auto"
});
if (popup.parameters.showClose && this.closeButton.parent().length > 0) {
this.closeButton.before(clone);
if (actionButtons.find("input[value='Cancel']").length > 0)
this.closeButton.remove();
} else
clone.appendTo(this.footer);
}
var sourceButtons = actionButtons.find("button,input[type='submit']");
clone.find("button,input[type='submit']").each(function (index, button) {
var sourceButton = sourceButtons[index];
button = $(button);
button
//.off("click")
.click(function (event) {
$(sourceButton).click();
});
button.data(popup.iframe[0].contentWindow.$(sourceButton).data());
//This is a bit weird, but the event needs to be attached to the JQuery instance in the iframe.
//At the time this code is executed, $ by itself references the host page popup.iframe[0].contentWindow.$("#" + sourceButton.id)
.on("prop", function (event) {
button.prop.apply(button, [].splice.call(arguments, 1));
})
.on("attr", function (event) {
button.attr.apply(button, [].splice.call(arguments, 1));
})
.on("removeProp", function (event) {
button.removeProp.apply(button, [].splice.call(arguments, 1));
})
.on("removeAttr", function (event) {
button.removeAttr.apply(button, [].splice.call(arguments, 1));
});
});
popup.containerDiv.height(popup.containerDiv.height() - actionButtons.height());
actionButtons.hide();
if (popup.parameters.showClose && actionButtons.has("input[type='submit'][value='Close']").length > 0)
this.closeButton.remove();
}
if (popup.parameters.sourceElement) {
var form = $("#form1")[0];
if (form.removeAttribute)
form.removeAttribute("target");
else
form.target = null;
form.action = form.action.substring(0, form.action.length - 6);
}
popup.unwait();
window.setTimeout(function () {
popup.resize({ load: true, urlChanged: urlChanged });
}, 250);
}
},
this.iframeLoaded = function (event) {
var popup = ELMS.WebControls.Popup.getPopup(event.target);
if (popup.parameters.sourceIframe && popup.parameters.sourceIframe.tagName && popup.parameters.sourceIframe.tagName == "IFRAME") {
popup.iframe[0].contentWindow.document.open();
var html = $(popup.parameters.sourceIframe.contentWindow.document.documentElement).html();
if ($.browser.msie)
html = html.replace(/\<script/gi, "<script defer='true'");
popup.iframe[0].contentWindow.document.write(html)
popup.iframe[0].contentWindow.document.close();
}
$(event.target.contentDocument).ready
(
function () {
popup.iframeContentLoaded(popup);
}
);
};
this.hide = function (parameters) {
parameters = $.extend({ destroy: true, runCloseFunction: false }, parameters);
if (parameters.runCloseFunction && !_that.preClose.call(this))
return;
var topWindow = ELMS.Common.getTopLevelWindow();
if (this.displayed) {
if (parameters.destroy)
this.outsideContainerDiv.remove();
else
this.outsideContainerDiv.hide(); //just hiding
if (parameters.element) {
ELMS.Common.undimElementBackground(element);
} else {
ELMS.Common.undimBackground();
}
this.displayed = false;
}
if (parameters.destroy) {
var popups = topWindow.ELMS.Page.Popups;
for (var i = 0, popup; popup = popups[i]; i++) {
if (popup == this)
popups.splice(i, 1);
}
}
return this;
};
this.resize = function (parameters) {
this.resizing = true;
parameters = $.extend({ height: null, width: null, basedOnContent: false, load: false, urlChanged: false }, parameters);
//If nothing sent in, ignore!!
if (!parameters.height && !parameters.width && !parameters.basedOnContent && !parameters.load)
return;
parameters.widthSupplied = parameters.width != null;
parameters.heightSupplied = parameters.height != null;
var iframeBody = this.iframe[0].contentDocument ? this.iframe[0].contentDocument.body : this.iframe[0].contentWindow.document.body,
titleH2Height = null;
if (this.titleH2)
titleH2Height = this.titleH2.outerHeight();
if ((!this.parameters.height && parameters.load) || parameters.basedOnContent) {
//this.iframeContainerDiv.height(0);
parameters.height = iframeBody.clientHeight;// + ($.browser.msie ? 35 : 0);
} else if (this.parameters.height)
parameters.height = this.parameters.height;
if (parameters.heightSupplied)
this.parameters.height = parameters.height;
if (parameters.height)
this.containerDiv.animate({ height: parameters.height + (titleH2Height || 10) }, 250); //10 is offset of top margin
//this.containerDiv.height(parameters.height);
if ((!this.parameters.width && parameters.load) || parameters.basedOnContent) {
if (parameters.basedOnContent || parameters.urlChanged || (parameters.load && !this.widthResized)) {
parameters.width = iframeBody.scrollWidth - 10;//10 - right padding on container div for close button
this.widthResized = true;
}
} else if (this.parameters.width)
parameters.width = this.parameters.width;
if (parameters.widthSupplied)
this.parameters.width = parameters.width;
if (parameters.width)
this.outsideContainerDiv.width(parameters.width);
//this.iframe.css("height", "100%");
this.outsideContainerDiv.height(this.containerDiv.height() + 400);
if (titleH2Height != null)
this.iframe.css("margin-top", (titleH2Height + 11).toString() + "px"); //11 is 10 for offset of top margin plus 1 for border of h2
var _that = this;
window.setTimeout(function () { _that.resizing = false; }, 250);
};
this.destroy = function (parameters) {
this.hide(parameters);
ELMS.Common.unregisterPopup(this);
};
if (this.parameters.sourceElement) {
var _popup = this;
$(this.parameters.sourceElement).click(
function (event) {
var form = $("#form1")[0];
form.target = "PopupIframe";
var qs = ELMS.Common.parseQueryString(form.action);
if (typeof qs.Popup == "undefined")
form.action += (Object.keys(qs).length == 0 ? "?" : "&") + "Popup";
_popup.show();
});
}
}
var control =
{
name: "Popup",
getPopup: function (iframeOrUrl) {
for (var i = 0, popup; popup = ELMS.Common.getTopLevelWindow().ELMS.Page.Popups[i]; i++) {
if (typeof iframeOrUrl == "string") {
if (popup.parameters.url == iframeOrUrl ||
(popup.iframe && popup.iframe[0].contentWindow.location.href == iframeOrUrl))
return popup;
} else {
if (popup.iframe) {
if (popup.iframe[0] == iframeOrUrl)
return popup;
} else {
if (popup.parameters.url == iframeOrUrl.src)
return popup;
}
}
}
return null;
},
createPopup: function (parameters) {
if (parameters.width)
parameters.widthProvided = true;
parameters = $.extend({ x: 20, y: 20, showClose: false, showTitle: true, closeDestroys: true, showFooter: true }, parameters);
if (!parameters.url && !parameters.sourceElement && !parameters.sourceIframe) {
alert("parameters.url must be specified (Popup.createPopup).");
return;
}
if (parameters.showClose)
parameters.showFooter = true;
if (parameters.url) {
var qs = ELMS.Common.parseQueryString(parameters.url),
qsCount = 0;
if (!qs.Popup) {
for (var prop in qs)
if (prop != parameters.url)
qsCount++;
parameters.url += (qsCount == 0 ? "?" : "&") + "Popup";
}
}
var topWindow = ELMS.Common.getTopLevelWindow();
parameters.headerHeight = topWindow.$("#header").height();
if (parameters.headerHeight && parameters.headerHeight > parameters.y)
parameters.y = parameters.headerHeight + 50;
var popup = new ELMS.Constructs.Popup(parameters);
if (!topWindow.ELMS.Page.Popups) {
topWindow.ELMS.Page.Popups = [];
}
topWindow.ELMS.Page.Popups.push(popup);
ELMS.Common.registerPopup(popup);
if (popup.parameters.sourceIframe && popup.parameters.sourceIframe.tagName && popup.parameters.sourceIframe.tagName == "IFRAME") {
popup.iframe.css("display", "block");
popup.show();
}
return popup;
},
convertLinkToPopupWithClose: function (event, informParentOnClose) {
return ELMS.WebControls.Popup.convertLinkToPopup(event, { showClose: true, closeInformsParent: informParentOnClose | false });
},
convertLinkToPopup: function (event, parameters) {
event.preventDefault();
event.stopPropagation();
var hyperlink = $(event.target).closest("a")[0],
parameters = $.extend(
{
url: hyperlink.href,
caller: hyperlink,
event: event,
buttonSelector: ".buttons",
usesHelp: false,
title: event.target["title"]
}, parameters);
var popup = ELMS.WebControls.Popup.createPopup(parameters);
if (ELMS.Page.receivePopupMessage)
popup.addMessageCallback(ELMS.Page.receivePopupMessage);
popup.show();
return popup;
}
};
ELMS.Common.registerWebControl(control);
jQuery.fn.convertLinkToPopup = function () {
this.each(function (index, element) {
$(element).click(ELMS.WebControls.Popup.convertLinkToPopup);
});
};
jQuery.fn.convertLinkToPopupWithClose = function () {
this.each(function (index, element) {
$(element).click(ELMS.WebControls.Popup.convertLinkToPopupWithClose);
});
};
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
 |
Please do not just dump all your code and expect people to explain it to you. You have been here long enough to know the procedure.
|
|
|
|
 |
Yeah I do accept my mistake but what can I do friend, its totally u-turn in technology, earlier I did javascript coding but just used some events in them getElementByID etc but this jQuery with lot of new concepts and so many things I am trying to learn it, if you can please help me.
One more thing is in the above code he is assigning function to a variable I am not sure why is he doing it all these things are big doubts.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
 |
A nice tutorial to JQuery is here[^].
Click on the Classroom link, and proceed.
|
|
|
|
 |
Hi All,
I am new for the jquery world, I have an unordered list in the following way in which each list item has span field, and I have another radio button in whose checked changed event I want to find which list item or span is selected using jquery.
Can I find any way to do it? Any help a link, suggestion or code snippet really helps me a lot. Please help me thanks in advance.
<ul id="reports-All_Reports" class="active"><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/ChildDates.rdl&Dynamic">Child Dates</span><span class="description">Detailed date information about an individual child (for DEL only).</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/Demographics.rdl">Child Demographics</span><span class="description">Characteristics of children and families enrolled in ECEAP</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/ChildSummaryReport.rdl">Child Record Summary</span><span class="description">Enrollment, health, child development and family information for an individual child.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/Classlist.rdl">Class List</span><span class="description">Lists Class names and characteristics.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/ClassRoster.rdl">Class Roster</span><span class="description">Lists child names, birthdate, first language, parent name and contact information, with space for staff to add notes.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/ClassSummary.rdl">Class Summary</span><span class="description">Shows information entered on the Class pages of ELMS for one class, or compiled for a site, contractor or (for DEL staff) statewide.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/ContractorList.rdl">Contractor List</span><span class="description">Lists Contractor names and characteristics.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/DevelopmentalScreening.rdl">Developmental Screening</span><span class="description">Children's development screening dates and results.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/EceapDirectorsRoster.rdl">Directors Roster</span><span class="description">List of ECEAP contractors, funded ECEAP slots, directors, contact information and counties served.</span></li><li class="report"><span class="title" report-url="/ELMS/Reports/Definitions/QRISReport.rdl">ELMS Site Data for Early Achievers</span><span class="description">List of all ECEAP and Head Start sites for the current school year.</span></li><li class="report active"><span class="title" report-url="/ELMS/Reports/Definitions/EnrollmentByChild.rdl">Enrollment by Child</span><span class="description">Lists children with their age, poverty level, IEP status, priority points and first and last days attending class.
<input id="phb_rdbCurrentEnrollment" type="radio" name="ctl00$phb$ReportMode" value="rdbCurrentEnrollment" checked="checked">
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
 |
var old = $.fn.carousel $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('carousel') , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) , action = typeof option == 'string' ? option : options.slide if (!data) $this.data('carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } $.fn.carousel.defaults = { interval: 1000 , pause: 'hover' }
<pre lang="xml"><script> $('.carousel-inner').carousel({ interval: 2000 })</script></pre> I want to move slider/carousel automatically without clicking first to start
|
|
|
|
 |
You'll have to look through the code for the carousel plugin and find the click event and instead change that code to run on a timer or however you want it to run.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
Here is what I have so far. I cant get it to work.
This application stores the last name, first name, and score for one or more students and it calculates the average score for all of the scores that have been entered.
When the user clicks on the Clear button, this application clears the score data from this application.
When the user clicks on the Sort button, this application sorts the data in alphabetical order by last name.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Scores</title>
<link rel="stylesheet" type="text/css" href="default.css" />
<script type="text/javascript" src="student_scores.js"></script>
</head>
<body>
<div id="content">
<h1>Student Scores</h1>
<div class="formLayout">
<label>Last Name:</label>
<input type="text" id="last_name" /><br />
<label>First Name:</label>
<input type="text" id="first_name" /><br />
<label>Score:</label>
<input type="text" id="score" /><br />
<label> </label>
<input type="button" id="add_button" value="Add Student Score" /><br />
</div>
<h2>Student Scores</h2>
<p><textarea id="scores" rows="5" cols="60"></textarea></p>
<div class="formLayout">
<label>Average score:</label>
<input type="text" id="average_score"/><br />
<label> </label>
<input type="button" id="clear_button" value="Clear Student Scores" /><br />
<label> </label>
<input type="button" id="sort_button" value="Sort By Last Name" /><br />
</div>
</body>
</html>
var scores = [];
var $ = function (id) { return document.getElementById(id) }
var displayScores = function () {
var scoreNumber = parseInt( $("score").value );
var scoreString = $("last_name").value + ", " +
$("first_name").value + ": " +
$("score").value;
if (scoreSting.length == 0) {
for (var i = 0; i < displayScores.length; i++) {
var scores = displayScores[i];
for (var i in scores) { displayScores += scores[scoreString] + ", "; }
$("average_score").value = getAverageScore(scoreNumber);
}
var addScore = function () {
var scoreNumber = parseInt( $("score").value );
var scoreString = $("last_name").value + ", " +
$("first_name").value + ": " +
$("score").value;
scores.push(scoreNumber);
scoresString.push(scoreString);
displayScores();
}
var getAverageScore = function () {
var scoreNumber = score.length;
var sum = 0;
if (scoreNumber > 0) {
for (var i = 0; i in scoreNumber; i++)
sum += score[i][2];
}
$("average_Score").value = sum / scoreNumber;
}
var sortScores = function () {
scoresString.sort();
displayScores();
}
}
window.onload = function() {
$("add_button").onclick = add_button;
$("sort_button").onclick = sort_button;
}
modified 17-Feb-15 18:14pm.
|
|
|
|
 |
WebDesignStudent wrote: I cant get it to work.
is not enough information. What is it doing? What is it supposed to do? Please edit the question to add detail and context.
|
|
|
|
|