Back | Reverse | Quick Reply | Post Reply |

need help in javascript
Link | by Atsuku(binku) on 2009-08-10 10:28:00 (edited 2009-08-10 10:37:53)
1. [JAVASCRIPT IS DISABLED] id="source" language="Javascript" type="text/Javascript">
$(function () {
var d1 = [];
for (var i = 0; i < 14; i += 0.5)
d1.push([i, Math.sin(i)]);

var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];

// a null signifies separate line segments
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];

$.plot($("#placeholder"), [ d1, d2, d3 ]);
// other abbreviation
$("#whole").click(function () {
$.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });
});

});
actually what method/kind of code writing is it? using $? i get in from flot charting with jquery code.

2.
var d;
function fill() { d = 34; }
function get() {
alert(d);
}
fill();
get();
/*how can i get var d with 34 filled in it from fill()? global? static? how? */
/*feel like to erase first line, but the point is = "return ?" is prohibited

thx.

Re: need help in javascript
Link | by Bonta_kun on 2009-08-17 08:12:24
Jquery is designed so that you don't have to add JavaScript into you html(I think their aim is like css).

its a module that you have to initialize first to use.

here is a link to the tutorial

instead of adding a onclick to each tag you just use "$("#whole").click(function () {" and it runs the code inside that function. where "#whole" is the ID of the html tag. well you'll get the picture after going through the tutorial.

I suggest you browse through the "API Reference".

just one tip when you initialize it use this kind of code.

"var variable_name = jQuery.noConflict();"

you could use any name for the variable_name and use that instead of the $ symbol.
it prevents you code from having conflicts with other jquery codes. just in case you use it with other jquery codes made by other people.

2.
since its not inside any function it should be accessable any where in the code.

Re: need help in javascript
Link | by andori-kun on 2009-09-07 01:12:16
I've just begun myself studying about jscript.
I hope mina-san from gendou will help me sometime.
10x.


Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.0022 seconds at 2024-12-30 12:03:20