Browsing articles in "JavaScript"

Change Lightbox 0.5 Image Size

Update 2011: For those people who had problems with the below instructions.. please find in on my website here. And when you’re there take a look at my site and see what you think about it :)

Lightbox 2 has the functionality to set maximum width and height. But what about previous versions? To set the maximum image width and height for lightbox (version 0.5) you need to do some extra coding yourself. Open the jquery.lightbox-0.5.js file and search for the next pieces of code (in bold below):

    settings = jQuery.extend({
        maxWidth: null,
        maxHeight: null,
    ...

Then search for the next function (in bold) and write copy and paste the code underneath it: Continue reading »

ASP.Net | Read Values from Javascript

Today I started checking out some videos about Windows CardSpace and ASP.Net for logging in and I saw how he used javascript to get client side input and use it in ASP.Net in the C# code.

First you need to create a HiddenField on your webForm and name it TokenField (any name would actually do)

<asp:HiddenField ID=”TokenField” runat=”server” />

To set the Hidden Field value in JavaScript use the following code: Continue reading »

Project NINE | Launching 29th November

Project NINE Web Design

Finally the day has come, for Malta to experience a new concept in web development on www.nine.com.mt. Today we just made our first advert on the timesofmalta.com as till now is going very good.

Clients will have many features for a small price. Stay tuned as we’re going to reveal more before Monday!

Why the word Project?

We chose the word project instead of concept or design for the simple fact that this website will be always evolving. There are so many things that we have ready for it. And we are the type of persons that listen.

Why Nine?

We chose the number Nine as it is a magic number. It’s amazing what  Try this…

- Multiply any number by nine (be it 10, or 15, or thousands or millions).

- Then repeatedly add the digits of the resulting number until it is just one digit

- You’ll end up with NINE

Next are some examples:

2 × 9 = 18 (1 + 8 = 9)

9 × 9 = 81 (8 + 1 = 9)

234 × 9 = 2106 (2 + 1 + 0 + 6 = 9)

578329 × 9 = 5204961 (5 + 2 + 0 + 4 + 9 + 6 + 1 = 27 (2 + 7 = 9)) Continue reading »

Project NINE | Start Registering

Start Registering your interest for this New Web Design Concept: “Great Web Design for a Small Price”!

How Do I Register?

You can go to our website nine.com.mt and insert your email address…

or you can also visit our facebook page from here and click Like.

More Information will be available very soon :)

Thanks!

 

Online Javascript Compressor

This might help some developers and designers… a Javascript Compressor. It’s extremely useful as it compresses the javascript code resulting in a smaller js file thus a faster loading website.

Thanks to minifyjs.com you do not need to install anything, just load the next website and paste the javascript code form the js file that you need to compress.

The resulting text should be copied in the js file. You can load the website by clicking here.

Happy compressing!!

Substring vs Substr | Javascript

The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. This method extracts the characters in a string between “from” and “to”, not including “to” itself. Continue reading »

Remove Special Characters (like !, %, &, #) from String | Javascript

No, this post is not about dieting or anything like that… but to remove Special Kharacters. To do this, I was going to use a for loop in javascript that checks each character and if it is not between ‘A’ and ‘Z’, the character will be removed. Until I found this code lying around on the net which makes removing special characters very simple…

function removeSpecialChars(strVal)
{
strVal = strVal.replace(/[^a-zA-Z 0-9]+/g,”);
}

Response.End()

Response End

This is added after the text needed in the response stream is written using the Response.Write() so no other html or garbage is written in the response stream.

Without response.end() javascript will have the text and the remaining garbage.

[ex. 1] without response.end()

Response.Write(“err”);
…..
result =”err

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” ><head><link href=”../App_Themes/Default/Content.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Default.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/EmailSender.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Header.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Header2.css” type=”text/css” rel=”stylesheet” /><link href=”../App_Themes/Default/Sidebar.css” type=”text/css” rel=”stylesheet” /><title> </title></head><body>    <form name=”form1″ method=”post” action=”WebService.aspx” id=”form1″><div><input type=”hidden” name=”__VIEWSTATE” id=”__VIEWSTATE” value=”/wEPZwUPOGNjY2JiNjJiNWQ5MDI41In2qlnOWzD0wbpAPF80y1dPYTA=” /></div>
</form></body></html>” Continue reading »

Reference Controls from MasterPage

To reference controls from a master page in a normal page use the following syntax:

Ex. Reference the Head Html tag of the Master Page from a normal page to add scripts in the head. Set the Head as runat=”server” and give id=”Head”, then enter the following syntax:

HtmlHead headTag = ((HtmlHead)((MasterPageName)this.Master).FindControl(“Head”));

Hope this helps. Btw this will mostly be used in Visual Studio 2005 since in the new versions, you can add an ContentPlaceHolder in the Head tag of the Master page and insert any scripts in the PlaceHolder on the page

Return Array from Web Service using ScriptManager & Javascript

 This is used to call the Web Service using ASP.Net and Script Manager. Must be inserted in .aspx page. 

<asp:ScriptManager runat=”server” ID=”scriptManager”>
<Services>
<asp:ServiceReference path=”WebService/TestService.asmx” />
</Services>
</asp:ScriptManager>

This is the script to call the web service method and print the result on the form: Continue reading »

Pages:12»

Check these Out!

Subscribe and get the latest posts in your inbox by entering your email address below