vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Prompting For Hyperlinks Please

[F] Prompting For Hyperlinks Please - Posted By CåñåÐå™ (canada) on 25th Mar 08 at 4:27pm
I'll like a code for when you click on the url button (in the ubbc) that it will have an prompt box pop-up . It will have "Enter Link" and then you will enter the link, and click ok once you click ok it would then have "Enter Text" which you would enter an word to show in post , and not the link .
when you click on the word you will go to where its linked to.

(Like what InvisionFree has for its url hyperlink)

Thanks {Grin} .

http://tropolis.virtualforums.co.uk/

Re: Prompting For Hyperlinks Please - Posted By Marc (cr0w) on 25th Mar 08 at 9:02pm
Give me a minute. {Smile}

Re: Prompting For Hyperlinks Please - Posted By CåñåÐå™ (canada) on 26th Mar 08 at 2:22am
Ok thanks Marc {Smile} .

Re: Prompting For Hyperlinks Please - Posted By Marc (cr0w) on 26th Mar 08 at 3:13am
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*
  4. URL Popup 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>
 


Enjoy. {Smile}

Re: Prompting For Hyperlinks Please - Posted By CåñåÐå™ (canada) on 26th Mar 08 at 5:21am
Thank you very much Marc , it works fine {Grin} .

Re: Prompting For Hyperlinks Please - Posted By Marc (cr0w) on 26th Mar 08 at 7:25am
No worries. {Smile}

Re: Prompting For Hyperlinks Please - Posted By Michael (wrighty) on 26th Mar 08 at 10:28am
I would have just used the ubbc_add() function! {Tongue Out}