vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: [ASAP Please :P] Code Fix - View Topic
Topic Rating: *****
Printable View
dog199200
Guest
[ASAP Please :P] Code Fix (2nd Nov 08 at 7:18am UTC)
Resolved
Can someone please help me fix this code, for some reason the get variables ain't working after I switched the code's design to an array.

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*
  4. Guest Friendly Message by Dwight
  5. Copyright© 2008 Infinity Codes
  6. http://icodes.vforums.co.uk
  7. Do not Repost
  8. */
  9.  
  10. //Edit Below
  11.  
  12. var wtp = 2; //0 = above banner, 1 = above menu buttons, 2 = below menu buttons
  13.  
  14. var message = ['We hope you enjoy your visit.<br /><br /><br />You re currently viewing the our forum as a guest. This mean you are limited to certain areas of the board and there are some features you can not use. If you join our community, you ll be able to access the member-only sections, and use many member-only features such as customizing your profile, sending private messages, and voting in polls. Registration is simple, fast, and completely free.<br /><br /><br /><font color="#FF6600">Join our community! <a href=/action/register>Register Now!</a></font><br /><br /><br />If you are already a member please login to your account to access all the features:']; // Do not use 's, they will cause the code to break.
  15.  
  16. var form = ['<form action=javascript:void;(0); onsubmit=login();>Username: <input type="text" id="un" size="20"> Password: <input type="password" id="pw" size="20"> <input type="submit" value="Login"></form>'];
  17.  
  18. //Edit Above
  19.  
  20. function build(){
  21. var wt = document.getElementByI00;("welcome_table");
  22. var nRow=wt.insertRow(wtp);
  23. var nCell=nRow.insertCell(0);
  24. nCell.className="window1";
  25. nCell.innerHTML = message + "<br />" + form;
  26. }
  27. function login(){
  28.     get('username','name')[0].value = get('un','id').value;<span><wbr /></span>
  29.     get('password','name')[0].value = get('pw','id').value;<span><wbr /></span>
  30.     get('loginForm','name').submit();
  31. }
  32. if(location.href.match(/.co.uk($|\/$)/) && vf_username == 'guest'){
  33.     build();
  34. }
  35. //-->
  36. </script>
 
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: [ASAP Please :P] Code Fix (7th Nov 08 at 8:07pm UTC)
I see numerous <span><wbr /></span> tags in the code you posted. Were those placed into the code by you, or is that something that happened when you posted the code here?

rroll.to— Shorten a link, rickroll your friends.
dog199200
Guest
Re: [ASAP Please :P] Code Fix (9th Nov 08 at 4:10am UTC)
I didnt add them in

Edit: but I went ahead and removed them
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: [ASAP Please :P] Code Fix (9th Nov 08 at 6:17pm UTC)
Since you're using an array, to add the message and form anywhere, you need to tell it which index in the array to grab. You would need to use message[0] and form[0] to access it.

However, I see no reason for you to be using arrays; they are completely useless in this situation and only add to the amount of time & processing power needed for the code to run. {Unsure}

rroll.to— Shorten a link, rickroll your friends.
dog199200
Guest
Re: [ASAP Please :P] Code Fix (10th Nov 08 at 12:28am UTC)
i was using arrays to make the code easier to edit instead of one big code area to edit, by using an array I have it so the information is split up and easier to edit, at least in my own opinion.

And ok i'll add those in when i get home and see what happeneds
dog199200
Guest
Re: [ASAP Please :P] Code Fix (10th Nov 08 at 3:31am UTC)
Edit: OK Ross Pm'd me what was wrong, I forgot to add a [0] to the submit function.
 Printable View

All times are GMT+0 :: The current time is 7:04am
Page generated in 0.2964 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums