Simple Machine Codes
March 18, 2010, 11:29:34 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to SMC, the best place for your SMF For Free Codes
 
  Home Help Search Arcade Affiliates Code Index Staff List Calendar Members Login Register  

Combination image-url-email prompts


Pages: [1]   Go Down
  Print  
Author Topic: Combination image-url-email prompts  (Read 454 times)
0 Members and 1 Guest are viewing this topic.
Celebrus
Artificially Conscious
Administrator

Offline Offline

Gender: Male
Posts: leet


aka Omikron


View Profile WWW
« on: December 17, 2007, 07:52:09 am »

This is the first code modification that I've attempted...this is the URL prompt code that Agent Moose wrote, which I modified slightly to include image prompts and e-mail prompts. (For lack of a better name, I called it "Agent Moose's Coffee Time Supercode".) This is working well on my forum, so I thought I'd share, if it's OK with Moosie...

Code:
<!--Agent Moose's Coffee Time Supercode-->
<script>
$("img[alt='Insert Hyperlink']").parent("a").attr("href","java"+"script:Hyper();");
$("img[alt='Insert Hyperlink']").parent("a").attr("onclick","");
function Hyper(){
//Created by Agent Moose with slight modifications by Coffeenole (smcodes.smfforfree3.com)
var hyperlink = prompt("Enter URL for Link:","http://");
if(!hyperlink){
alert("You must enter a URL for your Link!"); return;
};
var hypername = prompt("Enter Link Name:","");
if(!hypername){
alert("You must enter a Name for your URL!"); return;
};
document.postmodify.message.value += "\[url="+hyperlink+"\]"+hypername+"\[/url\]";}
$("img[alt='Insert Image']").parent("a").attr("href","java"+"script:image();");
$("img[alt='Insert Image']").parent("a").attr("onclick","");
function image(){
var image = prompt("Enter URL for Image:","http://");
if(!image){
alert("You must enter a URL for your Image!"); return;
};
document.postmodify.message.value += "\[img\]"+image+"\[/img\]";}
$("img[alt='Insert Email']").parent("a").attr("href","java"+"script:email();");
$("img[alt='Insert Email']").parent("a").attr("onclick","");
function email(){
var email = prompt("Enter the E-Mail address:","");
if(!email){
alert("You must enter a vaild E-mail address!"); return;
};
document.postmodify.message.value += "\[email\]"+email+"\[/email\]";}
</script>

Moose, if there is any way to make this better, it won't hurt my feelings...I'm not very well-versed in coding, but this does provide a couple of decent functions.

Did you know that my first ever attempt at coding was trying to add the Chronicles stylesheet to Agent's Skin Chooser code. It never worked, though. I just switched to the All Skin Chooser then.
Report Spam   Logged



Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Hostgator Hosting