473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to make color in innerHTML

77
Hello, i want to make a color in the text of innerHTML with this script

Expand|Select|Wrap|Line Numbers
  1. <script language = "javascript">
  2. var color = "FFF000"; 
  3. document.getElementById('showEmailValidation').innerHTML = "<font color=#"+color+">"test"</font>";
  4.  
  5. </script>
but it didn''t succeed, any idea??
Jul 22 '08 #1
5 9502
maminx
77
For your information, the fault is not in "inn erHTML", i only wrong in putting the script into this editor,...

so, any idea???
Jul 22 '08 #2
maminx
77
For your information, the fault is not in "inn erHTML", i only wrong in putting the script into this editor,...

so, any idea???

ok/...sorry, i';ve already solved the problem...

So to solve that problem, the script become like this one below :

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2.  
  3. var color = "#FF0000";
  4. document.getElementById('showEmailValidation').innerHTML = "<font color="+color+">test</font>";
  5.  
  6. </script>
  7.  
thanks for all,,,

best regards, mamin
Jul 22 '08 #3
maminx
77
ok/...sorry, i';ve already solved the problem...

So to solve that problem, the script become like this one below :

<script language="javascript">

var color = "#FF0000";
document.getElementById('showEmailValidation').inn erHTML = "<font color="+color+">test</font>";

</script>


thanks for all,,,

best regards, mamin

and again,,,the "innerHTML" (no empty space) is always printed become "inn erHTML"(there is an empty space) in the display,

just ignore that...tks
Jul 22 '08 #4
gits
5,390 Expert Mod 4TB
glad to hear that you found the mistake for yourself and for posting the solution. all attribute values should be in quotes always and one more note: just leave the language attribute of the script-tag ... it's deprecated ... just use the type attribute instead like this:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
kind regards
Jul 22 '08 #5
maminx
77
glad to hear that you found the mistake for yourself and for posting the solution. all attribute values should be in quotes always and one more note: just leave the language attribute of the script-tag ... it's deprecated ... just use the type attribute instead like this:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
kind regards

ok thanks...

kind regards :)
Jul 22 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Richard A. DeVenezia | last post by:
I hope this is the end of my present 'discovery' phase. I've learned alot about JavaScript in a short time and my head hurts. The following is what came out of all my questions and all the...
4
by: Chris | last post by:
How can I get the innerHTML of a <div> area only when the page loads, then use that variable in a function? Here is my code: function setContent(zz) { var lb =...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
15
by: | last post by:
Just about finished with an include modual that allows a user to select a color. Completely dynamic. all you have to do is include the script and run the main trigger script. One problem with...
17
by: PJ | last post by:
Greetings... I have stumbled upon a small problem. I use Ajax to retrieve part of a page I need to update. I update a DIV element with the HTML contents I get from another page. It works...
9
by: martymix | last post by:
simple question: I have a simple <dt>test text</dt> I get the innerHTML of that dt, and I try and append some text to it like so: dt = document.getElementsByTagName('dt') var text =...
2
by: artev | last post by:
for make on-fly some box te3xt and select, (select that will be use for to choose datas) is better to use Dom or innerhtml?
6
by: PaPa | last post by:
I'm not sure this is a javascript issue or an HTML issue. I notice that when I extract the contents of a div using the innerHTML property (?), that I wind up with a literal variable (?) which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.