473,385 Members | 1,523 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,385 software developers and data experts.

Change chatbox colors when board theme changes

Alright, so I'm working on a board and I want the chatbox located on the board to change colours whenever you change the board theme. I have a couple of questions: If I create a variable in a separate Javascript coding will it carry over to another set of Javascript code on the page?

Anyway, I'm totally winging this and I have NO experience with Javascript, but here's what I tried to do:

Expand|Select|Wrap|Line Numbers
  1. <script language="Javascript"><!--
  2. var x = akatsuki
  3.  
  4. if (x == akatsuki){
  5. document.CreateElement("<div><EMBED src="http://willoffirechat.chatango.com/group" bgcolor="#FFFFFF" width="500" height="500" wmode="transparent" allowScriptAccess="always" allowNetworking="all" type="application/x-shockwave-flash" flashvars = "a=CCCCCC&b=75&e=FFFFCC&h=FFFFCC&k=000000&l=999999&q=000000&r=100&s=1"></EMBED><br>[ <a href="http://willoffirechat.chatango.com/clonegroup">Copy this</a> | <a href="http://chatango.com/creategroup">Start New</a> | <a href="http://willoffirechat.chatango.com">Full Size</a> ]</div>")
  6. }
  7. //--></script>
  8.  
I realize that this is probably super wrong... >.>
Feb 18 '08 #1
4 2126
Awh, man! I posted this in the wrong area!
Feb 18 '08 #2
Alright, so I'm working on a board and I want the chatbox located on the board to change colours whenever you change the board theme. I have a couple of questions: If I create a variable in a separate Javascript coding will it carry over to another set of Javascript code on the page?

Anyway, I'm totally winging this and I have NO experience with Javascript, but here's what I tried to do:

Expand|Select|Wrap|Line Numbers
  1. <script language="Javascript"><!--
  2. var x = akatsuki
  3.  
  4. if (x == akatsuki){
  5. document.CreateElement("<div><EMBED src="http://willoffirechat.chatango.com/group" bgcolor="#FFFFFF" width="500" height="500" wmode="transparent" allowScriptAccess="always" allowNetworking="all" type="application/x-shockwave-flash" flashvars = "a=CCCCCC&b=75&e=FFFFCC&h=FFFFCC&k=000000&l=999999&q=000000&r=100&s=1"></EMBED><br>[ <a href="http://willoffirechat.chatango.com/clonegroup">Copy this</a> | <a href="http://chatango.com/creategroup">Start New</a> | <a href="http://willoffirechat.chatango.com">Full Size</a> ]</div>")
  6. }
  7. //--></script>

I realize that this is probably super wrong... >.>
Feb 18 '08 #3
wyatt
6
I'm not entirely sure, but I don't think that the createElement function can assign properties to tags, nor create multiple tags at once. I would instead do the following.

Expand|Select|Wrap|Line Numbers
  1. var div = document.createElement("div");
  2. var embed = document.createElement("embed");
  3. embed.src = "http://willoffirechat.chatango.com/group";
  4. embed.bgcolor = "#FFFFFF";
  5. ...
  6.  
  7. div.appendChild(embed);
  8.  
Note that this div will not display until it is appended to an element currently visible on the page. Say you had a div called "example", into which you wanted to place this code you just created. You could then run the following code to append it thus:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('example').appendChild(div);
  2.  
Also, if 'akatsuki' is a string, and not the name of a variable, it will have to be placed in quotes.

Finally, any variable declared in any piece of javascript should be readable in any other, provided they are not called from separate files (I think, but am not entirely sure, that this does not work).
Feb 18 '08 #4
acoder
16,027 Expert Mod 8TB
Threads merged and title changed.

Moderator.
Feb 18 '08 #5

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

Similar topics

1
by: Spike | last post by:
Hello! Im going to make a javascript for changing alot of images. But im not sure how to do it., where to start.. Ok, first.. this is the isue. I have 3 images(I call them 1a-3a). when u...
5
by: Dan Jacobson | last post by:
What's Nielsen talking about in http://www.useit.com/alertbox/20040503.html http://www.useit.com/alertbox/20040510.html Can't a good browser keep track of visited vs. unvisited link colors? Is my...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
5
by: Peter Wone | last post by:
The short version is that when the theme is changed my application barfs. The problem is a control I've created to host the WebBrowser control and implement all the com callbacks for browser...
2
by: Jéjé | last post by:
Hi, I have a web site with 3 themes. once the site is compiled I changing the stylesheetTheme option in the web.config has no effect!!!!! I continue to see the theme used at the compilation...
0
by: vikramp | last post by:
Hi, I am storing theme in web.config using <pages theme="mytheme"/>. I am then using the following code to read it from my webpage: Configuration config =...
5
by: Michael R | last post by:
Searching the net I've found a simple technique to add row numbers and alternate colors (for the even and the uneven row) to a continuous form. 1st step: Create a textbox, send it to background...
1
chunk1978
by: chunk1978 | last post by:
i've been searching for hours! nothing online makes sense... either that or my version of Flash CS3 is crazy... i know its easy to modify Actionscript 3.0 components... but all my code is AS2.0...
8
by: Mateusz Viste | last post by:
Hi, I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)... ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.