yui3

Loading a URL when dropdown option Changes in YUI

孤者浪人 提交于 2019-12-11 23:57:32
问题 I am trying to load a URL when a drop down menu changes via YUI Change event. I just want to navigate to that URL. I made a long search. But didn't got any way. Thanks :) 回答1: <select id="dropdown"> <option value="http://example.com/home">Home</option> <option value="http://example.com/about">Abount</option> </select> Y.one("#dropdown").on("change", function() { //'this' points to dropdown node //so it's value is a value of selected option. Assume you keep new url there document.location.href

Javascript alphabetical grouping

大兔子大兔子 提交于 2019-12-11 05:02:02
问题 I have a json array of objects that look like this: {id:'the id', name:'the name'}; and I need to loop over the array and group each object alphabetically by it's name attribute. Is there a way to do this without using a switch / if statement with every letter in it? What I don't want to do is something like this: if(data[i].name..slice(0, 1) == 'a') { ... } It's a large array, with almost a 1,000 objects in it. My goal is eventually append them to a dive so it looks something like this: 4 4

Pass data from server-side to YUI 3 JavaScript application

允我心安 提交于 2019-12-11 02:03:27
问题 I am working on rewriting my application from YUI 2 to YUI 3. Sometimes I need some data from database in my JavaScript environment. Firs option is to assign some global variables in JavaScript, but global vars is not good, so I did following in YUI 2: app.js YAHOO.namespace('MyApp'); YAHOO.MyApp = function() { var currencyRates; var userInfo; /* here a lot of code with event listeners and dom manipulations which uses currencyRates and userInfo variables */ return { initCurrencyRates:

How do I call a basic YUI3 function from within a normal JavaScript function?

▼魔方 西西 提交于 2019-12-08 08:47:27
问题 I'd like to call a simple YUI3 function from within a JavaScript function. Here is some code that does what I want in a very verbose way: function changeContent (message) { YUI().use("node", function(Y) { Y.all('#content-div').setContent(message); }); } Is there a better way to do this? NOTE: I don't want to attach this function to any event, I just want a global changeContent() function available. 回答1: If you want the API to exist outside of the YUI().use(...function (Y) { /* sandbox */ }),

Migrating from YUI2 to YUI3 and domready

有些话、适合烂在心里 提交于 2019-12-08 08:01:39
问题 I want to migrate the javascript in my site from YU2 to YUI3, but I am only a poor amateur programer and I am stuck at the first pitfall. I have the following code: MyApp.Core = function() { return { init: function(e, MyAppConfig) { if (MyAppConfig.tabpanels) { MyApp.Core.prepareTabpanels(MyAppConfig.tabpanels); } }, prepareTabpanels: function(tabpanels) { // Code here } } }(); var MyAppConfig = { "tabpanels":{"ids":["navigation"]} }; YAHOO.util.Event.addListener(window, "load", MyApp.Core

How do I call a basic YUI3 function from within a normal JavaScript function?

♀尐吖头ヾ 提交于 2019-12-08 04:29:29
I'd like to call a simple YUI3 function from within a JavaScript function. Here is some code that does what I want in a very verbose way: function changeContent (message) { YUI().use("node", function(Y) { Y.all('#content-div').setContent(message); }); } Is there a better way to do this? NOTE: I don't want to attach this function to any event, I just want a global changeContent() function available. If you want the API to exist outside of the YUI().use(...function (Y) { /* sandbox */ }), you can capture the returned instance from YUI(). (function () { // to prevent extra global, we wrap in a

JavaScript YUI3 using global variables?

天大地大妈咪最大 提交于 2019-12-06 03:40:24
I can't work out how to update a global variable from within YUI3. Consider the following code: window.myVariable = 'data-one'; var yuiWrap = YUI().use('node',function(Y) { console.log(window.myVariable); // 'data-one' window.myVariable = 'data-two'; console.log(window.myVariable); // 'data-two' }); console.log(window.myVariable); // 'data-one' Can anyone explain this to me? It's causing me a lot of trouble. Why can window.myVariable be accessed but not properly updated from within a YUI3 block? I think it might have something to do with Closures but I don't understand why Closures should

YUI 3 programmatically fire change event

本秂侑毒 提交于 2019-12-04 10:11:48
问题 I was wondering how to programmatically fire a change event with YUI3 -- I added a change listener to one select box node: Y.get('#mynode').on('change', function(e) { Alert(“changed me”); }); and somewhere else in the script want to fire that event. It works, of course, when a user changes the select box value in the browser. But I've tried many ways to fire it programmatically, none of which have worked. Including: // All below give this error: T[X] is not a function (referring to what's

Please explain in detail this part of YUI3 CSS Reset

旧时模样 提交于 2019-12-04 04:05:43
问题 What is the usefulness of these 2 things in CSS reset? What is the problem in resizing of input elements in IE and in which version? and if legend color doesn't inherit in IE then how it can be solved adding color:#000; /*to enable resizing for IE*/ input, textarea, select { *font-size:100%; } /*because legend doesn't inherit in IE */ legend { color:#000; } 回答1: The first rule actually doesn't apply on IE only, but on all webbrowsers. Normally you would like to define a global font in the

Please explain in detail this part of YUI3 CSS Reset

99封情书 提交于 2019-12-01 20:04:01
What is the usefulness of these 2 things in CSS reset? What is the problem in resizing of input elements in IE and in which version? and if legend color doesn't inherit in IE then how it can be solved adding color:#000; /*to enable resizing for IE*/ input, textarea, select { *font-size:100%; } /*because legend doesn't inherit in IE */ legend { color:#000; } The first rule actually doesn't apply on IE only, but on all webbrowsers. Normally you would like to define a global font in the body : body { font: 1.1em verdana, arial, sans-serif; } But this doesn't get applied (inherited) on the form