jQuery函数+ Javascript函数 [英] Jquery Function + Javascript Function

查看:97
本文介绍了jQuery函数+ Javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中,我有一个解决方案,其中包含一个网页,对此我有两个功能,但一个是:

函数isThatAColor(s){
...
}


另一个是:

$(function(){
...
}


在jquery的函数内部,我需要使用javascript函数中具有的一些变量.

谁知道吗?

In visual studio i have a solution wich contains a webpage that I have two function on that but one is:

function isThatAColor(s) {
...
}


and the other is:

$(function () {
...
}


Inside the function of jquery i need to use some variables that i have in javascript function.

Anyone knows how ?

推荐答案

(function(){
...
}

在jquery的函数内部,我需要使用javascript函数中具有的一些变量.

谁知道吗?
(function () {
...
}

Inside the function of jquery i need to use some variables that i have in javascript function.

Anyone knows how ?


var color = new RGBColor(s);
var max = Math.max(color.r, color.g);
max = Math.max(max, color.b);
var scale = 1.0 / max;

function isThatAColor(s) {

    if (color.ok) {
        document.getElementById('result').style.backgroundColor = 'rgb(' + color.r + ', ' + color.g + ', ' + color.b + ')';
        document.getElementById('result-text').innerHTML = 'Red: ' + color.r + ', Green: ' + color.g + ', Blue: ' + color.b
              + '<br />' + color.toRGB() + ', Hex: ' + color.toHex();
        alert("Vermelho: " + color.r + "\n" + "Verde: " + color.g + "\n" + "Azul: " + color.b);
    }
    else {
        document.getElementById('result-text').innerHTML = 'Essa cor não existe na livraria, se pretender adicionar uma nova cor visite a livraria "RGB.js".';
        document.getElementById('result').style.backgroundColor = 'rgb(255, 255, 255)';
    }
};


(function(){ var perShapeGradient = { x1: 0 . 3 , y1: 0 , x2: 0 , y2: 0 }; var 图表;
(function () { var perShapeGradient = { x1: 0.3, y1: 0, x2: 0, y2: 0 }; var chart;


这篇关于jQuery函数+ Javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆