473,785 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change chatbox colors when board theme changes

3 New Member
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 2144
g1adiat0r
3 New Member
Awh, man! I posted this in the wrong area!
Feb 18 '08 #2
g1adiat0r
3 New Member
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 New Member
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 Recognized Expert Moderator MVP
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
3221
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 click on image 1a u change" image x" to image 1a when u click on image 2a u change" image x" to image 2a when u click on image 3a u change" image x" to image 3a
5
2422
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 site deficient as I have not messed with link colors? Does Nielsen address why all this can't be left up to the browser? Are link colors supposed to be special, like background images, to make a big impression?
18
10747
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 where they have been. I also agree to the background: Too many web authors keep uniform link colors or their pages, thereby confusing the users. What I have a hard time agreeing to is his conclusion that web authors should deliberately change the...
5
2861
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 customisation. The problem only occurs when it's present. I'll fix it, but first I need detailed info on exactly what happens to a winform when the theme changes. It seems to me that the native window would have to be recreated to pick up the new...
2
1728
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 time instead of the requested theme. what's appends?????
0
2227
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 = WebConfigurationManager.OpenWebConfiguration("~"); PagesSection section = (PagesSection)config.GetSection("system.web/pages"); string currenttheme = section.Theme;
5
27595
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 and select the first color. .ControlSouce =fRowNum(False) .Name = RowNum 2nd step: Add the following function to the form module: (for row numbers) Public Function fRowNum(Reset As Boolean) As Long Static I As Integer
1
8795
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 and i'm not changing it all just to change a color of the scroll bar... i opened HaloTheme.fla and changed all the colors for the scrollbar movies... saved it, restared flash, even restarted my computer... open HaloTheme.fla and the colors are the...
8
5213
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)... I recently put the following script online: <script type="text/javascript"><!-- function playmedia(mediafile) { newwindow=window.open(); if (window.focus) {newwindow.focus()} newwindow.document.write('<html>');
0
9489
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.