小编Ash*_*ley的帖子

如何在JavaScript中编写RGB颜色值?

我试图改变下面的功能swapFE()的颜色,我无法弄清楚如何写它.我被告知要将短语节点的颜色更改为颜色值(155,102,102).我试着这样做,你可以在函数的末尾看到see- parent.childNodes [1] .style.color =(155,102,102); 但它只是一个深蓝色的海军蓝.它应该是一个棕红色.我不知道我做错了什么.如何解决此问题以获得正确的RGB颜色?我知道我有其余的权利,它只是想弄清楚如何写出给我带来问题的颜色和价值.谢谢!

//this function changes the French phrase to an English phrase. 
    function swapFE(e) { 
           var phrase = e.srcElement;  
           //phrase.innerText = english[phrase.id]; 
           var parent = phrase.parentNode; 
           //childNodes[0] is the number of the phrase +1  
           var idnum = parent.childNodes[0]; 
           //parseInt takes a textstring and extracts it to make a number. Then you will subtract 1 from the number. 

       var phrasenum = parseInt(idnum.innerHTML)-1; 
       phrase.innerText = english[phrasenum]; 
       parent.childNodes[1].style.fontStyle= "normal"; 
       parent.childNodes[1].style.color= (155, 102, 102); 
  } 


function swapEF(e) { 
       var phrase …
Run Code Online (Sandbox Code Playgroud)

javascript rgb coding-style function colors

41
推荐指数
4
解决办法
14万
查看次数

如何实现hoverintent插件

我是jQuery的新手,想要将hoverintent插件添加到我的网站作为我的导航菜单.我被提到Brian Cherne的网站并看到要下载的代码,但我不太确定如何将它们放在一起以使其工作.有人可以使用添加的相应hoverintent插件代码发布html代码应该是什么样子吗?或者参考我的参考?我非常感激!谢谢!

html jquery menu hoverintent

11
推荐指数
1
解决办法
1万
查看次数

如何在JavaScript中为内容添加样式?

我一直在使用JavaScript文件,我的内容一直在使用短语.现在我想改变那些短语的风格.第一个函数(请参阅函数swapFE)我想将短语节点的字体样式更改为正常.并将短语节点的颜色更改为颜色值(155,102,102).第二个函数(参见swapEF)我想将字体样式更改为斜体,将字体颜色更改为黑色.我怎么写这些?我是在JavaScript中使用这些函数编写的,还是直接在CSS或HTML中应用样式更改?

这些是我想要将样式更改应用到的两个函数:

    //this function changes the French phrase to an English phrase.
function swapFE(e) {
       var phrase = e.srcElement; 
       //phrase.innerText = english[phrase.id];
    var parent = phrase.parentNode;
    //childNodes[0] is the number of the phrase +1 
    var idnum = parent.childNodes[0];
    //parseInt takes a textstring and extracts it to make a number. Then you will subtract 1 from the number.
    var phrasenum = parseInt(idnum.innerHTML)-1;
    phrase.innerText = english[phrasenum];

  }


function swapEF(e) {
       var phrase = e.srcElement; 
       //phrase.innerText = english[phrase.id];
    var parent = phrase.parentNode;
    var …
Run Code Online (Sandbox Code Playgroud)

javascript fonts coding-style colors

5
推荐指数
2
解决办法
5万
查看次数

如何增加HTML表格中列的宽度?

如何增加HTML表格中列的宽度?

以下是我的代码.我试图让<td>每一行中的第二个标记展开,以便输入文本框(第一个<td>标记)与cookie的名称和它的价格(第三个<td>标记)之间有更多的空间.有任何想法吗?

<!--Order Info. table -nested table 2 -->
<!--This is the first nested table within the main table -->
        <table border="0" width="65%" cellpadding="2">
        <!--Row 1 -->
                <tr>
                    <th colspan="3" align="left">Order Information</th>
                </tr>
        <!--Row 2 -->   
                <tr>
                    <td>QTY</td>
                    <td colspan="15"></td>
                    <td>Subtotal</td>
                    <td colspan="90"><input name="Gift Wrapping" id="Gift Wrapping" type="checkbox" /> Gift wrapping? (Additional charge of 1.95 per box)</td>
                </tr>
        <!-- Row 3 -->  
                <tr>
                    <td><input name="quantitya" id="quantitya" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Chocolate …
Run Code Online (Sandbox Code Playgroud)

html html-table cell width

2
推荐指数
2
解决办法
6万
查看次数