vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > URL Prompt Box

URL Prompt Box - Posted By Marc (cr0w) on 26th Mar 08 at 3:15am
This code makes a prompt box appear when your users click on the url ubbc button and asks them for the link's information, then automatically displays it in the textbox.

Preview

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*
  4. URL Prompt by Cr0w
  5. Copyright 2008
  6. Do not repost
  7. */
  8.  
  9. function urlPrompt(){
  10.     var url = prompt("What is the location you would like to link to?","http://");
  11.     if(url != "" && url != null){
  12.         var urlName = prompt("What would you like to name the link?","");
  13.         if(urlName != "" && urlName != null){
  14.             if(document.post_form){
  15.                 document.post_form.message.value += "[url=" + url + "]" + urlName + "[/url]";
  16.             }
  17.             else if(document.quick_reply_form){
  18.                 document.quick_reply_form.message.value += "[url=" + url + "]" + urlName + "[/url]";
  19.             }
  20.         }
  21.     }
  22. }
  23.  
  24. if(get('ubbc_buttons','id')){
  25.     get('ubbc_buttons','id').getElementsByTagName("a")[8].setAttribute("onclick","urlPrompt()");
  26. }
  27. else if(get('quick_reply_ubbc','id')){
  28.     get('quick_reply_ubbc','id').getElementsByTagName("a")[8].setAttribute("onclick","urlPrompt()");
  29. }
  30. //-->
  31. </script>
 


Global Footers. {Smile}

Re: URL Prompt Box - Posted By CåñåÐå™ (canada) on 26th Mar 08 at 5:29am
You forgot to say it goes in Global Footers {Grin} .

Re: URL Prompt Box - Posted By Marc (cr0w) on 26th Mar 08 at 7:24am
Lies. {Tongue Out}