vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Random text? (Thanks Marc and Wrighty)

[F] Random text? (Thanks Marc and Wrighty) - Posted By Tim (grievous) on 22nd Mar 08 at 3:34am
I don't know if this is possible, but i'd like a code to make like my custom title switch text, like the image randomizer.

possible?

Re: Random text? - Posted By Marc (cr0w) on 22nd Mar 08 at 4:19am
 
I don't know if this is possible, but i'd like a code to make like my custom title switch text, like the image randomizer.

possible?


Would this be available to all members, or just a few that you specify?

Re: Random text? - Posted By Tim (grievous) on 22nd Mar 08 at 4:21am
No, it will be just for me and if any of my staff request it.

Re: Random text? - Posted By Marc (cr0w) on 22nd Mar 08 at 4:23am
 
No, it will be just for me and if any of my staff request it.


I'll get to this later today; off to bed shortly. {Smile}

Re: Random text? - Posted By Tim (grievous) on 22nd Mar 08 at 4:29am
It's ok, take your time.

I know your working on this one and that image uploader in post. theres no rush.

Re: Random text? - Posted By Marc (cr0w) on 22nd Mar 08 at 6:23am
 
It's ok, take your time.

I know your working on this one and that image uploader in post. theres no rush.


This one shouldn't take too long. {Wink}

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 1:06am
<script>
/*Random Custom Title
Coded By Wrighty
No Ripping, Reposting or Claiming*/

var ct = {

    list: ["I'm God","Rawr","Fear Me"],

    d: get('td','tag'),
    do: function(){
        var x = Math.floor(Math.random()*ct.list.length);
        for(i=0;i < this.d.length;i++){
            if(this.d[i].width=='20%'){
                this.d[i].innerHTML = this.d[i].innerHTML.replace(/\[w_ran\]/,this.list[x]);
            }
        }
    }
};
ct.do();
</script>


Global Footer


Edit:     list: ["I'm God","Rawr","Fear Me"],

Simply add more things in ... eg:     list: ["I'm God","Rawr","Fear Me","Watch me eat you"],

Also, to add this to your profile, make your custom title: [w_ran]. Also, that can be done for anyone else that wants the same random custom title! {Smile}

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 1:09am
Can I put HTML in the code? like if I want the text bold?

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 1:12am
Yup! {Smile}

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 1:28am
I just tried it on my test forum and it didn't work.

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 1:30am
Link?

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 1:33am
http://testforum1.virtualforums.co.uk/

If needed, you can join and i can make u staff, if needed.

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 1:37am
recopy, vF added a ; for me! {Sad}

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 1:39am
wat?

ok.

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 1:41am
still not working {Sad}

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 2:09am
works for me on that test forum.

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:14am
I think i mite have the custom title part right, wat do I put in the CT?

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 2:19am
No, it works for me fine on your test forum.

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:23am
Weird, It doesn't show, all it shows is [w_ran].

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 2:26am
Link again?

Browser?

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:27am
http://testforum1.virtualforums.co.uk/

The weirdest thing, i'm using Avant, in which i'v never had problems with it.

Re: Random text? - Posted By Michael (wrighty) on 23rd Mar 08 at 2:30am
http://testforum1.virtualforums.co.uk/action/view_profile/user/admin/

It's working fine for me there! {Unsure}

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:32am
All i see everytime i f5 the page is [W ran]

Re: Random text? - Posted By Marc (cr0w) on 23rd Mar 08 at 2:40am
As I've never used Avant, I do not know how it parses coding, but I believe that's the issue.

Try this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Random Custom Titles */
  4. var ct = ["Rawr","Meow","Oink","Moo","Woof"];
  5.  
  6. var td = get('td','tag');
  7. var x = Math.floor(Math.random()*ct.length);
  8. for(i=0;i<td.length;i++){
  9. if(td[i].width=='20%'){
  10. td[i].innerHTML = td[i].innerHTML.replace(/\[w_ran\]/,ct[x]);
  11. }
  12. }
  13. //-->
  14. </script>
 

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:45am
Arrrgg Avant.

It's still not working. it's ok if you can't get it, I appreciate both of you for trying. I'll dig around in Avant and try to get to the problem.

Also, Marc, you should try Avant, i'v found it to be better than IE, FF and all the others, this is really the only problem i'v had.

Avant Browser Download

Re: Random text? - Posted By Marc (cr0w) on 23rd Mar 08 at 2:47am
 
Arrrgg Avant.

It's still not working. it's ok if you can't get it, I appreciate both of you for trying. I'll dig around in Avant and try to get to the problem.

Also, Marc, you should try Avant, i'v found it to be better than IE, FF and all the others, this is really the only problem i'v had.

Avant Browser Download


I might download it to test future codes, but I doubt it'll take over as my primary browser. {Tongue Out}

Try this:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /* Random Custom Titles */
  4. var ct = new Array("Rawr","Meow","Oink","Moo","Woof");
  5.  
  6. var td = get('td','tag');
  7. var x = Math.floor(Math.random()*ct.length);
  8. for(i=0;i<td.length;i++){
  9. if(td[i].width=='20%'){
  10. td[i].innerHTML = td[i].innerHTML.replace(/\[w_ran\]/,ct[x]);
  11. }
  12. }
  13. //-->
  14. </script>
 

Re: Random text? - Posted By Tim (grievous) on 23rd Mar 08 at 2:55am
YAY!

It worked, thanks Marc and Wrighty. Smiley

Re: Random text? - Posted By Marc (cr0w) on 23rd Mar 08 at 3:02am
 
YAY!

It worked, thanks Marc and Wrighty. Smiley


No worries. {Smile}

Re: [F]Random text? (Thanks Marc and Wrighty) - Posted By Michael (wrighty) on 23rd Mar 08 at 11:17am
What ya change?

Re: [F] Random text? (Thanks Marc and Wrighty) - Posted By Marc (cr0w) on 24th Mar 08 at 12:26am
 
What ya change?


Avant doesn't seem to understand JS classes very well. {Unsure}

Re: [F] Random text? (Thanks Marc and Wrighty) - Posted By Michael (wrighty) on 24th Mar 08 at 1:27am
 
 
What ya change?


Avant doesn't seem to understand JS classes very well. {Unsure}


N00by thing.