Stephen Groom Music Producer? Poker Pro? Sports Bettor? Tune in next post to find out

26May/080

SJGmusic progress

Well, the more observant of you will have noticed on my [url=http://www.groomi.net]Main Website[/url] there is mention of a website-in-creation called SJGmusic.com. Well I started to make a design and think of ideas for what to do with it to make it cutting-edge and modern-looking.

I haven't attempted to design a website since the internet was littered with a big network of sites copying one another and kids (myself included) trading links with 88x31px GIFs and big pixel font headers with every effect photoshop had thrown at it.

Obviously, I was in no good position to start making a website for what should some day be my livelihood, so off I trotted making a banner. I was toying with copying off of everyone else, and I came up with a number of ideas like not using images, using CSS etc. Eventually I fired up Photoshop and this is what I came up with:

[img]inc/img/misc/sjgmusic.png[/img]

This probably won't stick for very long and the colour is subject to change but I was after you guys' constructive criticism on how it is, and what to do to make it... better? :)

Thanks
Stephen

Share
Filed under: Site Updates No Comments
22May/080

18th birthday

So there it goes, another milestone in the dance of life. I am now legally an adult. Very little has changed except the ability to be kicked out of home at any time and the ability to buy alcohol to console my self if that were to happen :D .

Also now I can be bitter at life and complain every birthday that I got a year older.

I am being pretty bitter already, I have had a great time so far. I got great gifts and money so that I can start piecing together my home studio :) . 1 day of heavy drinking is out of the way and 2 more are to come.

PS. It is true, drinking is less fun when it's legal. Get it all out of the way when you are <18, and if you are in one of those silly states with a 21 limit: sucks to be you :D

Love
Stephen

Share
16May/080

RSS Feed added

Just a quick update to let you all know that I have added an RSS feed to the website.

RSS feeds are a brilliant way to receive site updates and be alerted when new blogs are posted. Please [url=http://blog.groomi.net/rss.php]subscribe to the feed[/url].

:)

Share
Filed under: Site Updates No Comments
12May/085

JAVASCRIPT: Add BBCode buttons to a form

[i]There is a follow-up tutorial to this available [url=http://www.groomi.net/JAVASCRIPT:_Add_BBCode_buttons_to_a_form_(REVISITED)-,46]here[/url] which further improves the script adding another feature which improves ease and convenience of use.[/i]

Having just completed my code for buttons to insert BBCode into a textarea, I thought it was time to share my code with the world wide web.

First I will show you the HTML code I use at the time of this post

[code]<input type="button" onclick="bbcode_ins('comment', 'b')" value="B" style="width:15px;font-weight:bold;" />
<input type="button" onclick="bbcode_ins('comment', 'u')" value="_" style="width:15px;" />
<input type="button" onclick="bbcode_ins('comment', 'i')" value="I" style="width:15px;font-style:italic;" />
<input type="button" onclick="bbcode_ins('comment', 'img')" value="img" style="width:25px;" />
<input type="button" onclick="bbcode_ins('comment', 'url')" value="url" style="width:25px;" />
<input type="button" onclick="bbcode_ins('comment', 'php')" value="php" style="width:25px;" />
<input type="button" onclick="bbcode_ins('comment', 'code')" value="code" style="width:30px;" />[/code]

This basically puts a button for each available BBCode tag into the form where the textarea is located. The textarea in this example is called comment and when you click the button associated with the tag the following javascript function is called:

[i]bbcode_ins([b]field[/b], [b]tag[/b]);[/i]

Here is the javascript associated with the [i]bbcode_ins()[/i] function

[code]function bbcode_ins(fieldId, tag)
{
field=document.getElementById(fieldId);
if(tag=='b' || tag=='i' || tag=='u' || tag == 'php' || tag == 'code')
{
if (document.selection)
{
field.focus();
sel = document.selection.createRange();
sel.text = '[' + tag + '][/' + tag+']';
}
//MOZILLA/NETSCAPE/SAFARI support
else if (field.selectionStart || field.selectionStart == 0)
{
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
field.focus();
field.value = field.value.substring(0, startPos)
+ '[' + tag + '][/' + tag+']'
+ field.value.substring(endPos, field.value.length);
}
}
else if(tag == 'img')
{
var path = prompt('Enter image path', 'http://');
if(!path)
{
return;
}
if (document.selection)
{
field.focus();
sel = document.selection.createRange();
sel.text = '[' + tag + ']' + path + '[/' + tag+']';
}
//MOZILLA/NETSCAPE/SAFARI support
else if (field.selectionStart || field.selectionStart == 0)
{
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
field.focus();
field.value = field.value.substring(0, startPos)
+ '[' + tag + ']' + path + '[/' + tag+']'
+ field.value.substring(endPos, field.value.length);
}
}
else if(tag == 'url')
{
var url = prompt('Enter link URL', 'http://');
var linkText = prompt('Enter link text', '');
if(!url || !linkText)
{
return;
}
if (document.selection)
{
field.focus();
sel = document.selection.createRange();
sel.text = '[' + tag + '='+url+']' + linkText + '[/' + tag+']';
}
//MOZILLA/NETSCAPE/SAFARI support
else if (field.selectionStart || field.selectionStart == 0)
{
var startPos = field.selectionStart;
var endPos = field.selectionEnd;
field.focus();
field.value = field.value.substring(0, startPos)
+ '[' + tag + '='+url+']' + linkText + '[/' + tag+']'
+ field.value.substring(endPos, field.value.length);
}
}
}[/code]

[b]Now to explain the code:[/b]

[i]field=document.getElementById(fieldId);[/i]
This sets the variable [i]field[/i] to the element to be inserted into. eg. <input id="fieldId" />

The second parameter tag is tested to ask a variety of different questions depending on whether it is a hyperlink, image or simple bbcode tag. The important code is inside the if statements.

The first if inside of these is for IE browsers only. The line [i]if (document.selection)[/i] will only evaluate true if the code is executed in internet explorer. The next few lines of code then add the bbcode and give focus to the field.

The next alternative is with [i]else if (field.selectionStart || field.selectionStart == 0)[/i] and this evaluates to true for firefox/mozilla/safari etc etc. Inside this statement is another method of performing the same task for browsers that don't support the IE method.

[b]In summary[/b]
There it is, the code that makes my wonderful bbcode buttons work. Hope it can be of some use to somebody. If you have any questions/suggestions regarding this post please direct them to the comments

Thanks :)
Stephen
x

Share
Filed under: Tutorials 5 Comments