十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本文实例讲述了JavaScript实现彩虹文字效果的方法。分享给大家供大家参考。具体如下:
成都创新互联公司主要从事成都网站制作、成都网站建设、外贸营销网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务平城,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
HTML
HEAD
TITLERainbow Text/TITLE
[removed]
!-- Begin hide from old browsers
function createHexArray(n)
{
this.length = n;
for (var i = 1; i = n; i++)
this[i] = i - 1;
this[11] = "A";
this[12] = "B";
this[13] = "C";
setTextColor(0xFF0000FF);
//0xFF0000FF是int类型的数据,分组一下0x|FF|0000FF,0x是代表颜色整 数的标记,ff是表示透明度,0000FF表示颜色,注意:这里0xFF0000FF必须是8个的颜色表示,不接受0000FF这种6个的颜色表示。
setTextColor(Color.rgb(255, 255, 255));
setTextColor(Color.parseColor("#FFFFFF"));
//还有就是使用资源文件进行设置
setTextColor(this.getResources().getColor(R.color.blue));
//通过获得资源文件进行设置。根据不同的情况R.color.blue也可以是R.string.blue或者
//另外还可以使用系统自带的颜色类
setTextColor(android.graphics.Color.BLUE);
复制以下代码,修改相应地方即可:
private static void loadIndyFont()
{
UIManager.put("CheckBox.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Tree.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Viewport.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ProgressBar.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("RadioButtonMenuItem.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("FormattedTextField.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ToolBar.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ColorChooser.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ToggleButton.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Panel.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("TextArea.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Menu.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("RadioButtonMenuItem.acceleratorFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("Spinner.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Menu.acceleratorFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("CheckBoxMenuItem.acceleratorFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("TableHeader.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("TextField.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("OptionPane.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("MenuBar.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Button.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Label.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("PasswordField.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("InternalFrame.titleFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("OptionPane.buttonFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("ScrollPane.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("MenuItem.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ToolTip.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("List.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("OptionPane.messageFont", new java.awt.Font("宋体", 0, 12));
UIManager.put("EditorPane.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("Table.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("TabbedPane.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("RadioButton.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("CheckBoxMenuItem.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("TextPane.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("PopupMenu.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("TitledBorder.font", new java.awt.Font("宋体", 0, 12));
UIManager.put("ComboBox.font", new java.awt.Font("宋体", 0, 12));
}
记事本在TextArea 内设置字体没试过一般是在菜单栏上定义事件,
当你选择你要选的区域(所选文字)再点击相关按钮事件