vForums Support > Programming & Coding :: Code Requests & Support :: > [F] MP Background problem

[F] MP Background problem - Posted By Nick (nickb) on 17th Feb 08 at 4:41am
The code below is supposed to show a picture in the mini profile background but it isn't, what is the problem?

Code:
 
  1. <script>
  2. /*Mini Profile BG Image
  3. Created By Wrighty
  4. support.virtualforums.co.uk*/
  5.  
  6. if(document.profile_form && document.profile_form.hidden){
  7. var f  = document.profile_form;
  8. r = f.avatar_height.parentNode.parentNode.parentNode.parentNode.insertRow(16);
  9. r.insertCell(0).innerHTML = '<font size=2>Mini-Profile Bg:</font>';
  10. r.insertCell(1).innerHTML = '<input type="text" size="25" name="vf_mp">';
  11. r.insertCell(2).innerHTML = '<font size=1>Enter a URL to the image you want to use as the background for your miniprofile.</font>';
  12. f.vf_mp.value=(f.hidden.value.match(/\[vf_mp:(.+?)\]/))?RegExp.$1:'';
  13. f.hidden.value = f.hidden.value.replace(/\[vf_mp:(.+?)\]/,'');
  14. function save(){
  15. if(!f.vf_mp.value == "" ){
  16. f.hidden.value = '[vf_mp:'+f.vf_mp.value+']' +f.hidden.value;
  17. }}
  18. if(document.addEventListener){
  19. f.addEventListener('submit', save,false);
  20. }else{
  21. f.attachEvent('onsubmit', save);
  22. }}
  23. if(location.href.match(/view/)) {
  24. var x=document.getElementsByTagName('td');
  25. for(i=0;i<x.length;i++){
  26. if(x[i].width=="20%"){
  27. var d = x[i].getElementsByTagName('span')[0];
  28. BgImg= (d.innerHTML.match(/\[vf_mp:(.+?)\]/))?RegExp.$1:'';
  29. x[i].style.backgroundImage = 'url("'+BgImg+'")';
  30. }}}
  31. </script>
 


http://freunion.vforums.co.uk/action/view_profile

Thanks,
Darkmage

Re: MP Background problem - Posted By Michael (wrighty) on 17th Feb 08 at 12:33pm
try this:

Code:
 
  1. <script>
  2. /*Mini Profile BG Image
  3. Created By Wrighty
  4. support.virtualforums.co.uk*/
  5.  
  6. if(document.profile_form && document.profile_form.hidden){
  7. var f  = document.profile_form;
  8. r = f.avatar_height.parentNode.parentNode.parentNode.parentNode.insertRow(16);
  9. r.insertCell(0).innerHTML = '<font size=2>Mini-Profile Bg:</font>';
  10. r.insertCell(1).innerHTML = '<input type="text" size="25" name="vf_mp">';
  11. r.insertCell(2).innerHTML = '<font size=1>Enter a URL to the image you want to use as the background for your miniprofile.</font>';
  12. f.vf_mp.value=(f.hidden.value.match(/\[vf_mp:(.+?)\]/))?RegExp.$1:'';
  13. f.hidden.value = f.hidden.value.replace(/\[vf_mp:(.+?)\]/,'');
  14. function save(){
  15. if(!f.vf_mp.value == "" ){
  16. f.hidden.value = '[vf_mp:'+f.vf_mp.value+']' +f.hidden.value;
  17. }}
  18. if(document.addEventListener){
  19. f.addEventListener('submit', save,false);
  20. }else{
  21. f.attachEvent('onsubmit', save);
  22. }}
  23. if(location.href.match(/view/)) {
  24. var x=document.getElementsByTagName('td');
  25. for(i=0;i<x.length;i++){
  26. if(x[i].width=="20%"){
  27. var d = x[i].getElementsByTagName('span')[1];
  28. BgImg= (d.innerHTML.match(/\[vf_mp:(.+?)\]/))?RegExp.$1:'';
  29. x[i].style.backgroundImage = 'url("'+BgImg+'")';
  30. }}}
  31. </script>
 

Re: MP Background problem - Posted By Nick (nickb) on 17th Feb 08 at 7:10pm
Ok thanks Wrighty, it works.

Re: MP Background problem - Posted By Michael (wrighty) on 17th Feb 08 at 7:37pm
{Grin}