|
You have got the wrong idea. This is a forum to answer specific programming problem, not to do someone's homework/assignment. We are not helping you if we do it for you. The assignment is meant to gauge your understanding of what you have learned, if we do it for you, we get the grade, not you. How are you going to pass your test/exam subsequently,let alone graduating. Remember, no effort no gain, and study hard.
|
|
|
|
|
As Peter said, we're not going to do your homework for you. However, it sounds like you just need a hint to push you in the right direction.
document.write [^] will write the string to the document at the point where the function is called. You want to insert the string into a specific element, which means you need to get that element by ID, and update its inner HTML.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you so much. a push the right way was exactly what I was asking for.
|
|
|
|
|
|
Thank you. That was very helpful.
|
|
|
|
|
is it possible to get a value from another page using JavaScript language?
|
|
|
|
|
how is the value stored in the other page? e.g. In a label or textbox?
|
|
|
|
|
any value of text. contained the numbers itself in actually.. That is text only!
|
|
|
|
|
I don't know if there is any other way but the way I would extract values from another page is to use an IFrame(that is hidden) to load the page and then use JQuery to extract the values that I want, e.g.
var myVal = $('#iFrame').contents().find('#textBoxID').val();
This can give you an idea or lead you to your solution.
|
|
|
|
|
I have already tried to attain the line of the page inside computed to lines of page, just like that:
var col = 0;
var len = 0;
do{
col++;
len++;
while(col<67...
forexample i have not just my work on this topic which is already worked not around here!.. Count up to copies will line! and follow the selected.index.Value of html page constant to copy this line or any copy method
i mean that any copy method to attined a line of selected index value or is it possible to count of lines of any page?
|
|
|
|
|
I wanted to obtain a value that can be updated. Thanks a lot i try to JQuery method
|
|
|
|
|
Anyone worked on RequireJs, please I wanted to have some discussions for its optimization, required for my project.
Thanks
|
|
|
|
|
Yes, you can state your issue
|
|
|
|
|
Thanks ujjwal,
The Issue is that In my project the load time is too slow. And when I tested on Yslow it says 67 scripts are yet to be bundled, I mean they are still individuals and as per I read about Requirejs its analogous to MVC bundling and minification. So any way I can optimize or do bundling?
|
|
|
|
|
RequireJs is modular script loader, supporting Asynchronous Module Definition (AMD) API. Using this you can declare the dependency of a particular module, and only those scripts are loaded, and not all the dependencies of the project.
Well I have no much experience about MVC minification and bundling, but from what I read, its not the same-
1) Minification- You can achieve minification in javascript by using http://www.minifyjs.com/javascript-compressor/[^] or http://marijnhaverbeke.nl/uglifyjs[^]
2) bundling- Its bundling various js files to one file that is reducing the number of call http://www.sitepoint.com/asp-net-4-5-bundling-and-minification-support/[^] and http://www.monkeyphysics.com/articles/read/16/bundling_javascript.html[^]
3) Requirejs is just about loading script asynchronously, as and when that script is required
You start you application with data-main attribute in the cript loading tag as follows
<script src="/js/vendor/require.js" data-main="/js/main.js"></script>
Then in the main.js you write the require the files needed to start the application.
In this file you can use require.config to declare the configurations for the require, like the paths and shim(for the libraries that do not support AMD like underscore, handlebars etc.
require.config({
baseUrl:'/js/vendor',
paths : {
'models' : '/js/app/models',
'collections' : '/js/app/collections',
'views' :'/js/app/views',
'templates' : '/js/app/pages'
},
shim :{
underscore: {
exports: '_'
},
handlebars : {
exports : 'Handlebars'
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
}
}
});
Then you can start the application by using a require block. require block cause the required dependencies to be loaded before execution. require is normally written once at the start of the application, giving the application a initial kick start.
require(
[
],
function(App, HandlebarsUtil) {
// Register Handlebars helpers
HandlebarsUtil.registerHelpers();
// Kick off the application by requiring in the app and starting it
App.start();
}
);
in the app.js, and henceforth all other files have define block, where dependencies are listed and the variable name that they would be referred to in that script. the code is written as a function, which returns the object of functions for use in other function, like module pattern.
define(
[
'app/framework/AppConfig',
'app/framework/AppRouter',
'backbone'
],
function(AppConfig, Router, Backbone) {
'use strict';
return {
start: function start() {
}
};
}
);
|
|
|
|
|
Heyy man great, thanks a lot for your response would surely be handy for me..
|
|
|
|
|
Yeah you can go for requireJs apart from that do this tips also.Always load scripts from CDN, if it fails you can load from your folder.
To confirm that cdn script loaded you can check for existence any variable/function this script defines, if it is undefined - then cdn failed and you need to load local script copy.
On this principle are based solutions like that:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.5.1.min.js">
So that it will be cached.
(if there is no window.jQuery property defined cdn script didn't loaded).
You may build your own solutions using this method. For instance, jquery tooltip plugin creates $.tooltip() function so we can check it with code like this:
if (typeof $.tooltip === 'undefined') {
document.write('<script src="js/libs/jquery.tooltip.min.js">\x3C/script>');
}
Read http://stackoverflow.com/questions/5257923/how-to-load-local-script-files-as-fallback-in-cases-where-cdn-are-blocked-unavai[^]
See advantages here http://www.sitepoint.com/7-reasons-to-use-a-cdn/[^]
|
|
|
|
|
Nice & Helpful.
Thanks a lot for this
|
|
|
|
|
Glad it helped you. Please UpVote if it helped you
|
|
|
|
|
|
Checked but I am new to it, so if anyone has worked on it previously could guide. But still will go through that site again.
|
|
|
|
|
Hi ,
I workin on Gridview fixed header and footer while scrolling by using java script
<script language="javascript">
$(document).ready(function() {
try {
$(".divgrid").each(function() {
var grid = $(this).find("table")[0];
var ScrollHeight = $(this).height();
var gridWidth = $(this).width()-10;
var headerCellWidths = new Array();
// for (var i = 0; i < grid.getElementsByTagName('TH').length; i++) {
// headerCellWidths[i] = grid.getElementsByTagName('TH')[i].offsetWidth;
// }
grid.parentNode.appendChild(document.createElement('div'));
var parentDiv = grid.parentNode; var table = document.createElement('table');
for (i = 0; i < grid.attributes.length; i++) {
if (grid.attributes[i].specified && grid.attributes[i].name != 'id') {
table.setAttribute(grid.attributes[i].name, grid.attributes[i].value);
}
}
table.appendChild(document.createElement('tbody'));
table.getElementsByTagName('tbody')[0].appendChild(grid.getElementsByTagName('TR')[0]);
gridRow.getElementsByTagName('TD')[i].offsetWidth) {
}
var gridHeight = grid.offsetHeight;
if (gridHeight < ScrollHeight)
ScrollHeight = gridHeight;
parentDiv.removeChild(grid);
var dummyHeader = document.createElement('div');
dummyHeader.appendChild(table); parentDiv.appendChild(dummyHeader);
var scrollableDiv = document.createElement('div');
if (parseInt(gridHeight) > ScrollHeight) {
gridWidth = parseInt(gridWidth) + 17;
}
scrollableDiv.style.cssText = 'overflow:auto;height:' + ScrollHeight + 'px;width:' + gridWidth + 'px';
scrollableDiv.appendChild(grid);
parentDiv.appendChild(scrollableDiv);
});
}
catch (err) { }
}
);
</script>
<div class="divgrid">
<asp:GridView ID="gvEmployees" runat="server" ShowFooter="true">
<FooterStyle BackColor="Green" />
</asp:GridView>
</div>
now problem is alignment header columns width and data columns width are different size.
Thanks & Regards
Harsha
-- modified 14-Apr-14 10:22am.
|
|
|
|
|
In this kind of approach, you have to fix the width of header and columns manually.
Define and set width of each column in pixel and same width to corresponding data columns.
|
|
|
|
|
put css
.FixedHeader {
position: absolute;
font-weight: bold;
}
In gridview call this css to
HeaderStyle-CssClass="FixedHeader"
Sankarsan Parida
|
|
|
|
|
i am doing site if user select the indian map karanata or goa it will be display what is javascript of select image
if write this java script in html page i am passing parameter distcode and tal code
function getData(context, distCode, talCode)
{
window.location= "displayDistTal.aspx?context="+context+"&distCode="+distCode+"&talCode="+talCode;
}
|
|
|
|