|
|
please embed your code with < pre > tags. (the code button in the toolbar when editing/writing a post)
like this...
Code here. You can choose between different language settings HTML / XML / ASP and javascript is what you should use here in your case ...
hope this helps.
|
|
|
|
|
I'm having an issue with the legend options of JQPlot.
I can do some things with the legend like defining the labels (array legendlabels), showSwatches and placement and location.
But any attempt in changing the background, textColor or fontSize, ... doesn't work. The plot shows, the legend shows, but none of these options work. I've been up and down the provided samples and they work. I compared them with my prototype here (also all the css and js includes), but still no dice.
The code doesn't seem wrong as the plot (and legend) show, but some of the options don't seem to do anything.
legend: {
show: true,
labels:legendlabels,
location:"n",
rendererOptions: {
placement:"outsideGrid",
textColor: "rgb (255, 100, 100)",
fontSize: "18pt"
}
},
has anyone encountered this issue? How can I solve this?
(google's results didn't yield solutions for me either)
thanks!
[SOLUTION]
You need to add the correct javascript file at the bottom of the page:
<script class="include" type="text/javascript" src="./Scripts/JQPlot/plugins/jqplot.enhancedLegendRenderer.js"></script>
and use the
renderer:$.jqplot.EnhancedLegendRenderer,
option in the json definition.
then you place any css styling properties in the
rendererOptions: {}
object.
[/SOLUTION]
modified 23-Apr-14 9:27am.
|
|
|
|
|
I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.
<html>
<head>
<title>Invitation</title>
<meta charset="utf-8">
</head>
<body>
<p id="salutation">
</p>
<p id="image"></p>
<p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
</p>
<p>Sincerely,</p>
<p id="closingname"></p>
<script type="text/javascript" src="script\letter.js"></script>
</body>
</html>
And this is what I have for the .js:
"use strict";
function greeting() {
var textOne = "Dear";
var name = "John";
var punc = ",";
document.write(textOne + name + punc);
}
function complete() {
var yourName = "Gerald Blackmore";
var img = "<img src='image/partyimage.jpg'>";
greeting();
document.write(img);
document.write(yourName);
}
complete();
These are the teachers instructions:
Create the following web page and name it letter.html.
<html>
<head>
<title>Invitation</title>
<meta charset="utf-8">
</head>
<body>
You are invited to my house for a Cinco de Mayo party May 5, 2014.
Sincerely,
</body>
</html>
Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site.
Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file.
In the external JavaScript file you are to create two functions and invoke them. The first function should:
Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":".
The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:".
The second function should:
Accept three arguments, the salutation returned by the first function, the sender name which will be your name, and the image file name of your downloaded Cinco de Mayo image.
The function should then add the salutation string to the paragraph.
The function should then add the downloaded Cinco de Mayo image to the paragraph.
Finally, the function should add your name to the paragraph
|
|
|
|
|
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.
|
|
|
|
|