Change chatbox colors when board theme changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • g1adiat0r
    New Member
    • Feb 2008
    • 3

    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:

    [CODE=javascript]<script language="Javas cript"><!--
    var x = akatsuki

    if (x == akatsuki){
    document.Create Element("<div>< EMBED src="http://willoffirechat. chatango.com/group" bgcolor="#FFFFF F" width="500" height="500" wmode="transpar ent" allowScriptAcce ss="always" allowNetworking ="all" type="applicati on/x-shockwave-flash" flashvars = "a=CCCCCC&b=75& e=FFFFCC&h=FFFF CC&k=000000&l=9 99999&q=000000& r=100&s=1"></EMBED><br>[ <a href="http://willoffirechat. chatango.com/clonegroup">Cop y this</a> | <a href="http://chatango.com/creategroup">St art New</a> | <a href="http://willoffirechat. chatango.com">F ull Size</a> ]</div>")
    }
    //--></script>
    [/CODE]

    I realize that this is probably super wrong... >.>
    Last edited by acoder; Feb 18 '08, 10:36 AM. Reason: Added code tags
  • g1adiat0r
    New Member
    • Feb 2008
    • 3

    #2
    Awh, man! I posted this in the wrong area!

    Comment

    • g1adiat0r
      New Member
      • Feb 2008
      • 3

      #3
      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:

      [code=javascript]<script language="Javas cript"><!--
      var x = akatsuki

      if (x == akatsuki){
      document.Create Element("<div>< EMBED src="http://willoffirechat. chatango.com/group" bgcolor="#FFFFF F" width="500" height="500" wmode="transpar ent" allowScriptAcce ss="always" allowNetworking ="all" type="applicati on/x-shockwave-flash" flashvars = "a=CCCCCC&b=75& e=FFFFCC&h=FFFF CC&k=000000&l=9 99999&q=000000& r=100&s=1"></EMBED><br>[ <a href="http://willoffirechat. chatango.com/clonegroup">Cop y this</a> | <a href="http://chatango.com/creategroup">St art New</a> | <a href="http://willoffirechat. chatango.com">F ull Size</a> ]</div>")
      }
      //--></script>[/code]


      I realize that this is probably super wrong... >.>

      Comment

      • wyatt
        New Member
        • Feb 2008
        • 6

        #4
        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.

        [CODE=javascript]
        var div = document.create Element("div");
        var embed = document.create Element("embed" );
        embed.src = "http://willoffirechat. chatango.com/group";
        embed.bgcolor = "#FFFFFF";
        ...

        div.appendChild (embed);
        [/CODE]

        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:

        [CODE=javascript]
        document.getEle mentById('examp le').appendChil d(div);
        [/CODE]

        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).

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Threads merged and title changed.

          Moderator.

          Comment

          Working...