I need to implement a function called map (it needs to be written using reduce) in the below code that takes an array (arr) and a function (iter) as its arguments and returns an array with all its items transformed by iter, e.g. map([1, 2, 3, 4, 5], function(x) {return x * 2;}) should return [2, 4, 6, 8, 10]
I found out that (after an system update?) IE8 no longer loads the content on my website www.beautifullalaland.com. I guess it has to do with the ridiculous amount of jQuery calls that some of the simple functions requir. using JS for years but never a library (and never again if you ask me, what a bloody mess).
Is there a safe way to combine jquery_002.js, jquery.js, jquery_003.js and jquery-1.3.2.js?
All my font-sizes are set as relative sizes in CSS (large, medium, small, x-small, etc). Let's say something is set in CSS to be xx-large, but a visually impaired user wants it displayed even bigger. Can a script determine an element's absolute size, *as it is being rendered by the browser*, and then increment the element's font-size in absolute terms?
I'm attempting to make a web page that adapts to the size of your browser size when it maximized. Because I'm only 15 I'm not such a great programmer or coder. I've done my best with the resources I have though (Fluent in Lua and a natural ability to pick languages syntax up quickly)
Here is what I have so far, it doesn't work and it is starting to puzzle me. As it seems correct as I look at it. I'm sorry if this question show my ignorance. I try my best to hide it.
Some of it is Copy pasted from sources on Google. But only for educational purposes, I learn off reading, examining and testing out snippets.
I'm basically trying to get the max size of the window and resize the div accordingly.
where da boss wants our a large piece of our site to be fully dynamic and integrated on any screen size. This means changing font on size. Well I cam up with a solution, figured if no one has one better, then i'll share
I am new to Jquery mobile framework.I have an asp.net web application and I want to convert it into Jquery mobile framework.I have a datalist on an aspx page.The size of the datalist decreases according to the window size to certain extent after which the size of the datalist becomes constant and doesn't decrease with the window size.
How can I change my text or font size when the user changes the browser size. Example: When the browser is maximized, the font goes to normal, when the browser window decreased, the font size is reduce.
My program has divs that contain a single text node. I programatically set the myDiv.style.fontSize = "8pt"; When I call myDiv.offsetHeight, the number "14" is returned. I would like to be able to both predict the offsetHeight for various fontSizes and be able to reduce the offsetHeight.
I developed a web application and it is working fine, except for one issue. The application includes uploading files from a JSP to my servlet, and the issue is that i would like to have a limit for the uploaded files on the client side (before actually uploading it).
I investigated alot and found some ways like changing my JSPs to PHPs, which is not feasable for my application. I would also like to add that using the Flash component ("<object>") for uploading is not feasable also at this time. Using ActiveX does not work also (for some security issues in javascript, it can not access the system information, also ActiveX works only on IE).
I would like to add that I have my application running on Oracle application Server, JSPs for displaying the forms, MultiPart Java API for getting the form input values and files to my servlet and everything is developed in JAVA.
Either by limiting the file size or the limiting the whole request size sent to the servlet.
I'd have thought this would be easy but I've been looking for hours and all I can find is info on getting the viewport size, which is normally useful but not in my situation.
In this case I need the actual browser size, including the scrollbars, toolbars, status bars etc. to get an idea of browsers which aren't maximised/full screen and how big they are, and to calculate the amount of the screen taken up by toolbars etc too.
I want to popup a calendar (which is not difficult to many developer), but the difficulty to me is, how to make the user select only on a particular period, like he/she can only select a date from today to the date of (today + 10).
I have a button that opens a calendar and populates a text box. I use the onclick event to open the calendar.
Now the textbox has a onChange event that calls a function. The onChange fires perfectly if I type the date on the textbox, but if the calendar changes the date on the field then the onChange event doesn't fire.
I even try the following, but it seems that both functions run at the same time and the value on the field is never picked up.
I have a page of dates in a form field which currently are being entered manually and wish to have a calendar pop up for each one to make it a bit easier i have managed to use a calendar routine 'tigra calendar' i found online but now after working out not to get it working within my own template i faced the problem on multiple date fields.
i currently use a numbers field 1-10 or how every many there needs to be on that page. but how would i integrate this within the coding from 'tigra calendar' can anyone suggest a better way to do this.
if needed i can sort out a zip file of the files i have for tigra calendar.
Floating, "perpetual" calendar, displaying one month at a time, in a standard calendar grid. Click a date and a form field is populated with mm/dd/yyyy. Populate one or multiple form fields with a single click. May specify up to 7 form fields to populate. Customizations for jumping a number of months/years ahead or behind. Floats to the left hand side or the right hand side. Tested in IE6 & FF1.5.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Any Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript">
/* Copyright 2007, Michael J. Hill. Used with permission. www.javascript-demos.com */ /* Free use of the code, so long as BOTH copyright notices are kept intact */
// Customizations var defaultMonth = 0; // 1 displays next month onload, -6 displays six months ago var hopMonths = 6; // number of months to "jump" for Fast Forward and Rewind buttons var hopYears = 5; // number of years to "jump" var hiLiteToday = true; // if and when current month is displayed var floatTo = "right"; // right or left var clickField = [];//Do not delete this line, the following lines are optional and you may have up to 7 fields clickField[0] = "contractDate,Order Received"; // fieldName,Description clickField[1] = "startAssembly,Started Assembly"; clickField[2] = "endAssembly,Finished Assembly"; clickField[3] = "dateShipped,Order Shipped"; // End Customizations
// Do not edit below this line
var IE = false; if (navigator.appName == "Microsoft Internet Explorer"){IE = true} var monthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var refDate = ""; var today = ""; var usedToday = ""; var prevField = ""; var leftStr = ""; if (floatTo == "right"){leftStr = (screen.width)-235+"px"} if (floatTo == "left"){leftStr = "0px"} if (clickField.length > 0){for (t = 0; t < clickField.length; t++) {clickField[t] = clickField[t].split(",")}}
I wanted a small calendar for a web page that is created for the current month and highlights the current day and a date passed in. I also added a variable to show text when the cursor is over the highlighted dates. It's nothing special, but I like it and thought I'd share it. Here is the code and it is attached for downloading as well.
var month = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var moDays= [31,28,31,30,31,30,31,31,30,31,30,31];
function display(d,txt) {
var highlightDate = new Date(Date.parse(d)); var flag = false;
var startDate = new Date(); startDate.setDate(1);
if (new Date(startDate.getFullYear(),1,29).getDate() == 29) moDays[1] = 29;
var endDate = new Date(); endDate.setDate(moDays[endDate.getMonth()]);
if (highlightDate >= startDate && highlightDate <= endDate) flag = true; if (!txt) txt = "";
var start = 0 - startDate.getDay(); var end = endDate.getDate() + (7 - endDate.getDay());
var r = document.getElementById('calendar').insertRow(0);
for (i = start; i < end; i++) { if ((i - start - 1) % 7 == 0 && i != start) { r = document.getElementById('calendar').insertRow(-1); r.className = 'newRow' }
var c = r.insertCell(-1); if (i > 0 && i <= endDate.getDate()) { c.innerHTML = i; if (i == new Date().getDate()) { c.title = 'Today' c.className = 'selectedCell' } else { c.className = 'newCell' } if (flag && i == highlightDate.getDate()) { c.title = txt; c.className += ' highlightedCell' } } else { c.innerHTML = ' ' c.className = 'hiddenCell' } } var title = document.getElementById('calendar').rows[0].cells[0]; title.innerHTML = month[startDate.getMonth()] + ' ' + startDate.getFullYear(); title.colSpan = 7; title.className = 'title' }
I am trying to embed a calendar into my customers pages - the JS, CSS and jQuery are held on my server, so to allow my customers to just have to add one line of code, the link I give them, links to a JS file, which then dynamically loads the other files required, then adds a textbox, dropdown and button to the BOM, using document.write. However, to add the jQuery calendar to the textbox, I have to be sure jQuery has loaded. If it hasn't, by the time the page script hits the $( to check for jQuery, if it hasn't loaded, all of the jQuery is ignored. How can I get the script to stop and wait (without having the customer having to press a button)?
So I give my customers this one line: <script src="[URL]" language="javascript" type="text/javascript"></script>
The mt.js file contains... //JS to load files function loadjscssfile(filename, filetype) { if (filetype == "js") { //if filename is a external JavaScript file var fileref = document.createElement('script') fileref.setAttribute("type", "text/javascript") fileref.setAttribute("src", filename) }else if (filetype == "css") { //if filename is an external CSS file var fileref = document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref != "undefined") document.getElementsByTagName("head")[0].appendChild(fileref) } loadjscssfile("[URL]", "css"); loadjscssfile("[URL]", "js"); loadjscssfile("[URL]", "js"); //write GUI to DOM document.write("<input id="calendar" type="text" />"); document.write("<input id="btnCheck" type="button" value="Check" />"); document.write("<br /><div id="result" />"); //Jquery to add calendar to textbox added above $(function () { $("#calendar").datepicker({ showOn: "button", .... .... });
So if the jQuery/UI/CSS hasn't loaded, the script will get here, without having added the jQuery calendar to the textbox.
My project is using Jquery calendar..and it works fine in Chrome,IE 7.But its not working in IE 8,means we are able to see the calendar..but not able to input the date..