Download

Slider-1-Title-Here

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Slider-2-Title-Here

In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.

Slider-3-Title-Here

Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.

Slider-4-Title-Here

dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui.

Slider-5-Title-Here

Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus.

Photoshop Tips : Zombifying 0

XIONG; | 9:13 AM |

A mini-tutorial to show you how to chop Mandy Moore into a Zombi.


Skulls and bones
After found a suitable source pic (1),  first used Hue/Saturation, to decrease the overall saturation and make the colours greener, and did this especially near the lips (2). For the head, I looked for a picture of a skull which was taken from roughly the same angle (3), and used a layer mask to make it seem as if her eye had been taken out (4).


Adding details
In the neck area (1), I used source pictures of a leg with spider veins (2), a mummy and a war victim (3). Source pictures which are usable for such a contest aren't always pleasant to look at... I experimented a lot with different blend modes, till it looked right. I finally decided the features of her body wheren't clear enough, so I did some masking adjustments to bring them back (4).



Dirty Laundry
The clothes (1) were soiled with a soft brush in red and greenish black colours, while using the overlay layer mode (2).


Finished
Finally it was time for some more detailed work. I took the image from (1) to (2) by, among other things:
- drawing little zits and such
- using hue/saturation very selectively to tone down the saturation and make some skin extremely green
- desaturating the hair completely
- using overlay, soft light and color burn layers and soft red and black brushes to add more shadow and bloody parts

Photoshop Tips : How To Make Your Own 3D Images 0

XIONG; | 8:54 AM |

Learn how to make one of those cool 3D images that you can look at with those 3D glasses.

What you are getting yourself into

We’ve all seen those cool 3D images on the back of cereal boxes or in the “Spy Kids 3D” movie. Even the Mars Lander has sent us 3D Photos. Now you can make your own 3D image by following this simple tutorial.

NOTE: It helps if you actually have a pair of these glasses. If you don't there are websites out there that offer them for free if you send them an adressed enveloppe.

Okay so let’s dive into the depths of the 3D world. Okay bad pun, I know.

As you all know there are usually more than one way to achieve a desired affect, but this method is what I’ve found works best for me. I used Photoshop CS, though it can easily be done in other versions as well as PaintShop Pro.



Taking the photos

First of all you’re gonna need to take your photos. Easiest would be with a digital camera but of course you can use a regular camera and scan the images… Up to you…
What the 3D image does, is simulate your eyes seeing 2 different photos, one for the left, and one for the right eye. So naturally, you’re gonna have to take 2 photos.
Find a nice subject with some nice depths and some texture. A bare wall with one subject won’t really do. It would be best to use a stand or something to put your camera on so that it doesn’t move vertically. Take one picture, for the left eye, and then move the camera a bit to the right, about the same distance as the distance between your eyes, about 7cm.
(This will give you the most realistic view, but feel free to increase the space for a more dramatic effect.)

Feel free to practice with my left eye and right eye pictures.


Left Eye

Right Eye

Upload your pics and save them “left_eye” and “right_eye” respectively.

And then there was no color...

Now we start working on the images, so fire up Photoshop or whatever program you use, and open your 2 images.(If you want to adjust your images before you start working on them, make sure you do the same layer/color adjustments on both images.)


First we will edit the left_eye photo. Select that image, and then change it to grayscale by going to Image…Mode…Grayscale. Then change it back to RGB


Next, change the right_eye photo to grayscale, but don’t change it back to RGB mode.

Here come the Red & Blue
 
Save your left_eye image as 3d_image, as this will be your final image.
Select your 3d_image, and display the channel window. If it is not visible, activate it by going to Window…Channels.
Select only the BLUE and GREEN channels by clicking one of them, and then selecting the other by pressing SHIFT as you click. Your image should now be only in blue.


Next select your entire right_eye image by going to Select…All. Copy it and paste it into the 3d_image, with only the blue and green channels still selected.
Now click the eye next to the RGB Channel, to activate all channels. Your image will now have a blue and red image overlapping.


Technically, you are done now, but your image might need some adjusting…

Now get some glasses
If your image was taken from very far away, you might need to move the 2 overlapping images closer. To do this, choose a point in the middle of the image that would be the same for both eyes.

Then select the red channel only, by clicking it once, and move the image so the point matches for both the red and the blue image.

Congratulations, you have your own 3D image. Let’s just hope you have one of those dorky glasses now.
NOTE: To get optimal results, move your head farther and closer to the image until you get a perfect 3D image.



For different results, experiment with different distances between your left and right eye phpotos, as well as the distance form the subject.

Photoshop Tips : How To Draw Anime 0

XIONG; | 8:21 AM |

This tutorial will show you how to draw anime-style hair eyes and basic head structure.




Introduction

Hi and welcome! Thanks for coming and taking a peek at this tutorial. Now get comfortable, grab a pen and paper, a drawing tablet or your mouse and let's draw a head! There are certainly other (and possibly better) ways of doing it. Please just accept it as one way of drawing anime.
Also, this is not a tutorial for beginners so you'll probably need basic or better PhotoShop, coloring and imagination skills before attempting this tutorial.
Let's proceed


Structure

First we'll tackle 'Structure'
We'll start with our working lines. A good start is a circle (diagram.1). So draw a circle.


Now draw a line where you want the center of the face (i'm going to call it the "noseline") down the middle, I've offset mine to the right and curved it around as if it were a ball, but instead of wrapping around the bottom, I've continued straight down so the noseline drops to around where the chin should be.

Then draw a second line around the center, like the equator, for your eyeline. Now lines from the eyeline where the ears go, about halfway around the ball (diagram.2)
Okay, draw rough outlines of ears from the earline back. Now add a jaw from just below the ear to the chin point. Note: You should be able to see the proper shape by now so if you drew your chin point too high or too low you'll probably notice it and can correct it.

Now do the same on the other side of the face: from earline to the chin.
I'm not exactly sure how I put the eyemarks in, I more or less guessed, but take a look at diagram.3 and guess too.
Now you should have something that looks like diagram.3.

Features
Now erase the equator eyeline, noseline and earlines, Don't erase the eyemarks (shown in red) and you could have something that looks like this or better. 


Now on a new layer draw the features in. I always start with the head outline, then the top of the eye, the lower lid, nose mouth and ear in that order. I'm using the same features I used for Yumi but heres some examples of anime-bits you can test out.
 


Now get rid of the bottom layer or completely erase the original pencil.
Add pupils, eyebrow lines, ear details, lips and now you should have lines ready to be tidied up and detailed.


  
Now turn the opacity on this layer down to around 20%
and on a new layer, or your pen start drawing the facial features one by one.


Eyes
Let's start with the eyes. Here's a step by step of this type of eye.


1. Draw the lash line or the eyelid in, Thicken it, with girl eyes I like to do that pointy sticky out bit.
2. Pupil and Iris, semi circle iris and quite a big pupil.
3. Erase a circle near the left of the pupil, this is a shiny effect. and fill in the sides of the iris.
4. Draw in an eyebrow and a small line above the lashes about one third the length of the eye in the centre.

5. Add any details you like, I added a second shiny thing, and some random lines inside the iris.


Now do exactly the same thing, backwards for the other side, except put the pupil in it's proper position, and don't mirror the iris pattern.

Adding nose, mouths and ears
Okay, Get rid of the eye working lines underneath and maybe you'll have this exact image (hopefully):




Now add a nose, mouth and ears. They're pretty straightforward - just tidy up the lines you have already have.
 Line the jaw and neck in. Necks can be skinny, fat, muscular or made up of two lines. Just draw lines until you are happy with neck width and length.

Hairstyle time 

Anime means awesome frikkin hairdos!
Go crazy on hairstyles - spikes, shorn, flowing metal, etc... Just make sure you don't cut into the head. Keep your major outline outside of the head, unless you really insist your character look stupid.




I chose this sort of Style for mine:





 It's all swirly fringed and spiky sided.


Shading
 

The next thing I do is shadows and shading. I do a cheap style of cel shading where I make a new layer above everything 'Color, Lines' and turn the opacity down to around 25% then I use a black brush and draw where I think needs a shadow. (BLACK)
 

Then I make a squiggly line across the hair in white on the same layer, although you may want it brighter
using the same sort of ball/skull shape. I draw another little shiny thing on the bottom lip and maybe half the of the iris. (WHITE)

 



Now draw these lines under the eyes. I don't know what they are, but include them anyway





Then on a new layer I add a little blush and lip color by putting a bright pink splotch (with a large softened brush) on the cheeks and carefully line the lips. Then I turn the layer into a multiply layer and fade it to around 20%.

Finally, add a pattern in the iris (perhaps a squiggly, perhaps a moon, perhaps a squiggly moon), add a second layer of shadow and whatever accessories you want - Glasses, Goggles, Face Hair, Piercings, etc... and you're all set!
 


That's all,  have fun and practice those eyes and hair they are the base of all cool anime!



Photoshop Tips : How To Create Rain 0

XIONG; | 7:47 AM |

Today we’re going to attempt to create a simplistic yet realistic rainy day. This is basically a beginner tutorial, and my first attempt at writing one, so stay with me here.


We're going to try to reproduce the effect achieved in turning this image:

                                               
         Before Edited                                After Edited with rain efftect


First thing you need to do is open the picture you want to add rain to. You can use any picture you want, or you can use the one provided. Next, duplicate the background layer (CTRL+J) by either dragging the layer to the “Create a New Layer” button at the bottom of the layers pallet OR going to Layer > Duplicate Layer…(this requires you to click “OK”).

Here’s the fun part! On your “background layer copy” go to Image > Image Adjustments > Curves… (CTRL+M) and make your setting something like this:



Or you can play around with them to get the desired effect you want. This gives the image that “dark rainy day” appearance.


The Rain

Next step, the rain! Create a new layer (Shift+CTRL+N) by clicking the “Create a New Layer” button as before, OR go to Layer > New > Layer… name it “Rain” and fill that layer with White (CTRL+Backspace). Head up to Filter > Noise > Add Noise… and your settings should be close to this:



Then head over to Filter > Blur > Motion Blur… and the setting should be close to this:


Now you need to head on over and adjust the levels. (CTRL+L) Go to Image > Image Adjustments > Levels… and my settings are:





But you can make them however you want.

Last step!! Go to the top of your layers pallet and change the mode to “Screen” and Voila! You have a rainy day!


Optional step! To double the amount of rain in your picture, just copy the “Rain” layer (CTRL+J) and press CTRL+T to pull up the transform handles. You can go to Edit > Free Transform… as well. Click just outside the bottom right handle, until the cursor looks bent. Then hold Shift and turn the layer clockwise until thebottom right corner becomes the top left corner. Then hit the “Commit” button at the top!

Java Script Interview Questions and Answers 0

XIONG; | 4:44 AM |




What is JavaScript?
JavaScript is a general-purpose programming language designed to let programmers of all skill
levels control the behavior of software objects. The language is used most widely today in Web
browsers whose software objects tend to represent a variety of HTML elements in a document and the
document itself.

How is JavaScript different from Java?
JavaScript was developed by Brendan Eich of Netscape; Java was developed at Sun Microsystems. While the two languages share some common syntax, they were developed independently of each other and for different audiences. Java is a full-fledged programming language tailored for network computing; it includes hundreds of its own objects, including objects for creating user interfaces that appear in Java applets (in Web browsers) or standalone Java applications. In contrast, JavaScript relies on whatever environment it's operating in for the user interface, such as a Web document's form elements.

What’s relationship between JavaScript and ECMAScript?
ECMAScript is yet another name for JavaScript (other names include LiveScript). The current
JavaScript that you see supported in browsers is ECMAScript revision 3.

How do you submit a form using Javascript?

Use document.forms[0].submit();
(0 refers to the index of the form – if you have more than one form in a page, then the first one has the
index 0, second has index 1 and so on)

How do we get JavaScript onto a web page?
You can use several different methods of placing javascript in you pages.
You can directly add a script element inside the body of page.

1. For example, to add the "last updated line" to your pages, In your page text, add the following:

<p>blah, blah, blah, blah, blah.</p>
<script type="text/javascript" >
<!-- Hiding from old browsers
document.write("Last Updated:" +
document.lastModified);
document.close();
// -->
</script>
<p>yada, yada, yada.</p>
(Note: the first comment, "<--" hides the content of the script from browsers that don't understand
javascript. The "// -->" finishes the comment. The "//" tells javascript that this is a comment so javascript doesn't try to interpret the "-->". If your audience has much older browsers, you should put this comments inside your javascript. If most of your audience has newer browsers, the comments can be omitted. For brevity, in most examples here the comments are not shown. )

The above code will look like this on Javascript enabled browsers,

2. Javascript can be placed inside the <head> element
Functions and global variables typically reside inside the <head> element.
<head>
<title>Default Test Page</title>
<script language="JavaScript" type="text/javascript">
var myVar = "";
function timer(){setTimeout('restart()',10);}
document.onload=timer();
</script>
</head>
Javascript can be referenced from a separate file Javascript may also a placed in a separate file on the server and referenced from an HTML page. (Don't use the shorthand ending "<script ... />). These are typically placed in the <head> element.
<script type="text/javascript" SRC="myStuff.js"></script>

How to read and write a file using javascript?
I/O operations like reading or writing a file is not possible with client-side javascript. However , this can be done by coding a Java applet that reads files for the script. How to detect the operating system on the client machine?

In order to detect the operating system on the client machine, the navigator.appVersion string (property) should be used. How can JavaScript make a Web site easier to use? That is, are there certain JavaScript techniques that make it easier for people to use a Web site? JavaScript's greatest potential gift to a Web site is that scripts can make the page more immediately interactive, that is, interactive without having to submit every little thing to the server for a server program to re-render the page and send it back to the client. For example, consider a top-level navigation panel that has, say, six primary image map links into subsections of the Web site. With only a little bit of scripting, each map area can be instructed to pop up a more detailed list of links to the contents within a subsection whenever the user rolls the cursor atop a map area. With the help of that popup list of links, the user with a scriptable browser can bypass one intermediate menu page. The user without a scriptable browser (or who has disabled JavaScript) will have to drill down through a more traditional and time-consuming path to the desired content.

How can JavaScript be used to improve the "look and feel" of a Web site? By the same token, how can JavaScript be used to improve the user interface? On their own, Web pages tend to be lifeless and flat unless you add animated images or more bandwidth-intensive content such as Java applets or other content requiring plug-ins to operate (ShockWave and Flash, for example).

Embedding JavaScript into an HTML page can bring the page to life in any number of ways. Perhaps the most visible features built into pages recently with the help of JavaScript are the so-called image rollovers: roll the cursor atop a graphic image and its appearance changes to a highlighted version as a feedback mechanism to let you know precisely what you're about to click on. But there are less visible yet more powerful enhancements to pages that JavaScript offers. Interactive forms validation is an extremely useful application of JavaScript. While a user is entering data into form fields, scripts can examine the validity of the data--did the user type any letters into a phone number field?, for instance. Without scripting, the user has to submit the form and let a server program (CGI) check the field entry and then report back to the user. This is usually done in a batch mode (the entire form at once), and the extra transactions take a lot of time and server processing power. Interactive validation scripts can check each form field immediately after the user has entered the data, while the information is fresh in the mind.

Another helpful example is embedding small data collections into a document that scripts can look up without having to do all the server programming for database access. For instance, a small company could put its entire employee directory on a page that has its own search facility built into the script. You can cram a lot of text data into scripts no larger than an average image file, so it's not like the user has to wait forever for the data to be downloaded


What are JavaScript types?
Number, String, Boolean, Function, Object, Null, Undefined.

How do you convert numbers between different bases in JavaScript?
Use the parseInt() function, that takes a string as the first parameter, and the base as a second
parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);

How to create arrays in JavaScript?
We can declare an array like this
var scripts = new Array();
We can add elements to this array like this

scripts[0] = "PHP";
scripts[1] = "ASP";
scripts[2] = "JavaScript";
scripts[3] = "HTML";

Now our array scrips has 4 elements inside it and we can print or access them by using their index number. Note that index number starts from 0. To get the third element of the array we have to use the index number 2 . Here is the way to get the third element of an array.
document.write(scripts[2]);
We also can create an array like this

var no_array = new Array(21, 22, 23, 24, 25);

How do you target a specific frame from a hyperlink?
Include the name of the frame in the target attribute of the hyperlink.
<a href=”mypage.htm”
target=”myframe”>>My Page</a>

What is a fixed-width table and its advantages?
Fixed width tables are rendered by the browser based on the widths of the columns in the first row,
resulting in a faster display in case of large tables. Use the CSS style table-layout:fixed to specify a
fixed width table. If the table is not specified to be of fixed width, the browser has to wait till all data is downloaded and then infer the best width for each of the columns. This process can be very slow for large tables.

Example of using Regular Expressions for syntax checking in JavaScript

var re = new RegExp("^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$");
var text = myWidget.value;
var OK = re.test(text);
if( ! OK ) {
alert("The extra parameters need some work.\r\n Should be something like: \"&a=1&c=4\"");
}

Where are cookies actually stored on the hard disk?

This depends on the user's browser and OS. In the case of Netscape with Windows OS,all the cookies are stored in a single file called cookies.txt

c:\Program Files\Netscape\Users\username\cookies.txt
In the case of IE,each cookie is stored in a separate file namely username@website.txt.
c:\Windows\Cookies\username@Website.txt

How to add Buttons in JavaScript?
The most basic and ancient use of buttons are the "submit" and "clear", which appear slightly before the Pleistocene period. Notice when the "GO!" button is pressed it submits itself to itself and appendsthe name in the URL.

<form action="" name="buttonsGalore" method="get">
Your Name: <input type="text" name="mytext" />
<br />
<input type="submit" value="GO!" />
<input type="reset" value="Clear All" />
</form>

Another useful approach is to set the "type" to "button" and use the "onclick" event.
<script type="text/javascript">
function displayHero(button) {
alert("Your hero is \""+button.value+"\".");
}
</script>

<form action="" name="buttonsGalore" method="get">
<fieldset style="margin: 1em; text-align: center;">
<legend>Select a Hero</legend>
<input type="button" value="Agamemnon" onclick="displayHero(this)" />
<input type="button" value="Achilles" onclick="displayHero(this)" />
<input type="button" value="Hector" onclick="displayHero(this)" />
<div style="height: 1em;" />
</fieldset>
</form>

What can javascript programs do?
Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc. can be detected Date and Time Handling

How to set a HTML document's background color?
document.bgcolor property can be set to any appropriate color.

How can JavaScript be used to personalize or tailor a Web site to fit individual users?

JavaScript allows a Web page to perform "if-then" kinds of decisions based on browser version, operating system, user input, and, in more recent browsers, details about the screen size in which the browser is running. While a server CGI program can make some of those same kinds of decisions, not everyone has access to or the expertise to create CGI programs. For example, an experienced CGI programmer can examine information about the browser whenever a request for a page is made; thus a server so equipped might serve up one page for Navigator users and a different page for Internet Explorer users. Beyond browser and operating system version, a CGI program can't know more about the environment. But a JavaScript-enhanced page can instruct the browser to render only certain content based on the browser, operating system, and even the screen size. Scripting can even go further if the page author desires. For example, the author may include a preference screen that lets the user determine the desired background and text color combination. A script can save this information on the client in a well-regulated local file called a cookie. The next time the user comes to the site, scripts in its pages look to the cookie info and render the page in the
color combination selected previously. The server is none the wiser, nor does it have to store any visitor-specific information.

Are you concerned that older browsers don't support JavaScript and thus exclude a set of Web users? individual users?
Fragmentation of the installed base of browsers will only get worse. By definition, it can never improve unless absolutely everyone on the planet threw away their old browsers and upgraded to the latest geewhiz versions. But even then, there are plenty of discrepancies between the scriptability of the latest Netscape Navigator and Microsoft Internet Explorer.

The situation makes scripting a challenge, especially for newcomers who may not be aware of the limitations of earlier browsers. A lot of effort in my books and ancillary material goes toward helping scripters know what features work in which browsers and how to either workaround limitations in earlier browsers or raise the compatibility common denominator. Designing scripts for a Web site requires making some hard decisions about if, when, and how to implement the advantages scripting offers a page to your audience. For public Web sites, I recommend using scripting in an additive way: let sufficient content stand on its own, but let scriptable browser users receive an enhanced experience, preferably with the same HTML document.

What does isNaN function do?
Return true if the argument is not a number.

What is negative infinity?

It’s a number in JavaScript, derived by dividing negative number by zero.

In a pop-up browser window, how do you refer to the main browser window that opened it?

Use window.opener to refer to the main window from pop-ups.

What is the data type of variables of in JavaScript?
All variables are of object type in JavaScript.

Methods GET and POST in HTML forms - what's the difference?
GET: Parameters are passed in the querystring. Maximum amount of data that can be sent via the GET
method is limited to about 2kb.
POST: Parameters are passed in the request body. There is no limit to the amount of data that can be
transferred using POST. However, there are limits on the maximum amount of data that can be
transferred in one name/value pair.

How to write a script for "Select" lists using javascript
1. To remove an item from a list set it to null
mySelectObject.options[3] = null;

2. To truncate a list set its length to the maximum size you desire
mySelectObject.length = 2;

3. To delete all options in a select object set the length to 0.
mySelectObject.leng

Text From Your Clipboard?
It is true, text you last copied for pasting (copy & paste) can be stolen when you visit web sites using a
combination of JavaScript and ASP (or PHP, or CGI) to write your possible sensitive data to a database
on another server.

What does the "Access is Denied" IE error mean?
The "Access Denied" error in any browser is due to the following reason.
A javascript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.

Is a javascript script faster than an ASP script?

Yes.Since javascript is a client-side script it does require the web server's help for its computation,so it is always faster than any server-side script like ASP,PHP,etc..

Are Java and JavaScript the Same?
No.java and javascript are two different languages. Java is a powerful object - oriented programming language like C++,C whereas Javascript is a clientside scripting language with some limitations.

How to embed javascript in a web page?
javascript code can be embedded in a web page between <script langugage="javascript"></script> tags

What and where are the best JavaScript resources on the Web?
The Web has several FAQ areas on JavaScript. The best place to start is something called the meta- FAQ [14-Jan-2001 Editor's Note: I can't point to it anymore, it is broken!], which provides a high-level overview of the JavaScript help available on the Net. As for fact-filled FAQs, I recommend one maintained by Martin Webb and a mini-FAQ that I maintain. For interactive help with specific problems, nothing beats the primary JavaScript Usenet newsgroup, comp.lang.javascript. Depending on my work backlog, I answer questions posted there from time to time. Netscape and Microsoft also have vendor-specific developer discussion groups as well as detailed documentation for the scripting and object model implementations.

What are the problems associated with using JavaScript, and are there JavaScript techniques that you discourage?
Browser version incompatibility is the biggest problem. It requires knowing how each scriptable browser version implements its object model. You see, the incompatibility rarely has to do with the core JavaScript language (although there have been improvements to the language over time); the bulk of incompatibility issues have to do with the object models that each browser version implements. For example, scripters who started out with Navigator 3 implemented the image rollover because it looked cool. But they were dismayed to find out that the image object wasn't scriptable in Internet Explorer 3 or Navigator 2. While there are easy workarounds to make this feature work on newer browsers without disturbing older ones, it was a painful learning experience for many.

The second biggest can of worms is scripting connections between multiple windows. A lot of scripters like to have little windows pop up with navigation bars or some such gizmos. But the object models, especially in the older browser versions, don't make it easy to work with these windows the minute you put a user in front of them--users who can manually close windows or change their stacking order. More recently, a glitch in some uninstall routines for Windows 95 applications can disturb vital parts of the system Registry that Internet Explorer 4 requires for managing multiple windows. A scripter can't work around this problem, because it's not possible to detect the problem in a user's machine. I tend to avoid multiple windows that interact with each other. I think a lot of inexperienced Web surfers can also get confused by them.

What Boolean operators does JavaScript support?
&&, || and !

What does "1"+2+4 evaluate to?
Since 1 is a string, everything is a string, so the result is 124.

What is the difference between a web-garden and a web-farm?

Web-garden - An IIS6.0 feature where you can configure an application pool as a web-garden and also specify the number of worker processes for that pool. It can help improve performance in some cases. Web-farm - a general term referring to a cluster of physically separate machines, each running a webserver for scalability and performance (contrast this with web-garden which refers to multiple processes on one single physical machine).

How to get the contents of an input box using Javascript?
Use the "value" property.
var myValue = window.document.getElementById("MyTextBox").value;

How to determine the state of a checkbox using Javascript?
var checkedP = window.document.getElementById("myCheckBox").checked;

How to set the focus in an element using Javascript?
<script> function setFocus() { if(focusElement != null)
{ document.forms[0].elements["myelementname"].focus(); } } </script>

How to access an external javascript file that is stored externally and not embedded?
This can be achieved by using the following tag between head tags or between body tags.

<script src="abc.js"></script> How to access an external javascript file that is stored externally and not
embedded? where abc.js is the external javscript file to be accessed.

What is the difference between an alert box and a confirmation box?
An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.

What is a prompt box?
A prompt box allows the user to enter input by providing a text box.

Can javascript code be broken in different lines?
Breaking is possible within a string statement by using a backslash \ at the end but not within any other javascript statement. that is ,

document.write("Hello \ world");
is possible but not document.write \
("hello world");

Taking a developer’s perspective, do you think that that JavaScript is easy to learn and use?
One of the reasons JavaScript has the word "script" in it is that as a programming language, the vocabulary of the core language is compact compared to full-fledged programming languages. If you already program in Java or C, you actually have to unlearn some concepts that had been beaten into you. For example, JavaScript is a loosely typed language, which means that a variable doesn't care if it's holding a string, a number, or a reference to an object; the same variable can even change what type of data it holds while a script runs. The other part of JavaScript implementation in browsers that makes it easier to learn is that most of the objects you script are pre-defined for the author, and they largely represent physical things you can see
on a page: a text box, an image, and so on. It's easier to say, "OK, these are the things I'm working with and I'll use scripting to make them do such and such," instead of having to dream up the user interface, conceive of and code objects, and handle the interaction between objects and users. With scripting, you tend to write a _lot_ less code.

What Web sites do you feel use JavaScript most effectively (i.e., best-in-class examples)? The
worst?

The best sites are the ones that use JavaScript so transparently, that I'm not aware that there is any scripting on the page. The worst sites are those that try to impress me with how much scripting is on the page.

How about 2+5+"8"?
Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.

What is the difference between SessionState and ViewState?
ViewState is specific to a page in a session. Session state refers to user specific data that can be accessed across all pages in the web application.

What does the EnableViewStateMac setting in an aspx page do?
Setting EnableViewStateMac=true is a security measure that allows ASP.NET to ensure that the viewstate for a page has not been tampered with. If on Postback, the ASP.NET framework detects that there has been a change in the value of viewstate that was sent to the browser, it raises an error -
Validation of viewstate MAC failed.
Use <%@ Page EnableViewStateMac="true"%> to set it to true (the default value, if this attribute is
not specified is also true) in an aspx page.

How to Accessing Elements using javascript?

To do something interesting with HTML elements, we must first be able to uniquely identify which element we want. In the example

<body>
<form action="">
<input type="button" id="useless" name="mybutton" value="doNothing" />
</form>
</body>
We can use the "getElementById" method (which is generally preferred) or we can use the older hierarchical navigation method,
document.forms[0].mybutton.style.color = "blue";
Notice that this uses the "name" attribute of the element to locate it.
# Example of Accessing Elements in a DOM.

<script type="text/javascript" >
function showStatus() {
var selectWidget = document.forms.beerForm.elements["beer"];
var myValue = selectWidget.options[selectWidget.selectedIndex].value;
alert('You drank a \"'+ myValue +"\"");
return true;
}
</script>
<form name="beerForm" action="">
<select name="beer">
<option selected="selected">Select Beer</option>
<option>Heineken</option>
<option>Amstel Light</option>
<option>Corona</option>
<option>Corona Light</option>
<option>Tecate</option>
</select>
<input type="button" name="submitbutton" value="Drink"
onclick="showStatus()" />
</form>

What looping structures are there in JavaScript?

for, while, do-while loops, but no foreach.
To put a "close window" link on a page ?
<a href='javascript:window.close()' class='mainnav'> Close </a>

How to hide javascript code from old browsers that dont run it?

Use the below specified style of comments <script language=javascript> <!-- javascript code goes
here // --> or Use the <NOSCRIPT>some html code </NOSCRIPT> tags and code the display html
statements between these and this will appear on the page if the browser does not support javascript

How to comment javascript code?

Use // for line comments and
/*
*/ for block comments

Name the numeric constants representing max,min values
Number.MAX_VALUE
Number.MIN_VALUE

What does javascript null mean?
The null value is a unique value representing no value or no object. It implies no object,or null string,no valid boolean value,no number and no array object.

How do you create a new object in JavaScript?
var obj = new Object(); or var obj = {};
How do you assign object properties?
obj["age"] = 17 or obj.age = 17.

What’s a way to append a value to an array?

arr[arr.length] = value;

What is this keyword?

It refers to the current object.

What does the term sticky session mean in a web-farm scenario? Why would you use a sticky
session? What is the potential disadvantage of using a sticky session?

Sticky session refers to the feature of many commercial load balancing solutions for web-farms to route the requests for a particular session to the same physical machine that serviced the first request for that session. This is mainly used to ensure that a in-proc session is not lost as a result of requests for a ession being routed to different servers. Since requests for a user are always routed to the same machine that first served the request for that session, sticky sessions can cause uneven load distribution across servers.

You have an ASP.NET web application running on a web-farm that does not use sticky sessions - so the requests for a session are not guaranteed to be served the same machine. Occasionally, the users get error message Validation of viewstate MAC failed. What could be one reason that is causing this error?

The most common reason for this error is that the machinekey value in machine.config is different for each server. As a result, viewstate encoded by one machine cannot be decoded by another. To rectify this, edit the machine.config file on each server in the web-farm to have the same value for machinekey.

To set all checkboxes to true using JavaScript?
//select all input tags
function SelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = true;
}
}
}

How to select an element by id and swapping an image ?
...
<script language="JavaScript" type="text/javascript" >
function setBeerIcon() {
var beerIcon = document.getElementById("beerIcon");
beerIcon.src = "images/"+getSelectValue("beer")+".jpg";
}
</script>
...
<img border="0" src="" id="brandIcon" alt="brand" />
<select name="beer" id="beer" onChange="setButton();setBeerIcon();">
<option value="--Select--">Select beer</option>
<option value="heineken">heineken</option>
<option value="sol">sol</option>
<option value="amstellight">amstellight</option>
<option value="coronalight">coronalight</option>
<option value="coronaextra">coronaextra</option>
<option value=""></option>
</select>

What does undefined value mean in javascript?

Undefined value means the variable used in the code doesn't exist or is not assigned any value or the property doesn't exist.

What is the difference between undefined value and null value?
(i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
(ii)typeof undefined variable or property returns undefined whereas typeof null value returns object

What is variable typing in javascript?
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows
example
i = 10;
i = "string";
This is called variable typing

Does javascript have the concept level scope?
No. JavaScript does not have block level scope, all the variables declared inside a function possess the
same level of scope unlike c,c++,java.

What are undefined and undeclared variables?

Undeclared variables are those that are not declared in the program (do not exist at all),trying to read their values gives runtime error.But if undeclared variables are assigned then implicit declaration is done .

Undefined variables are those that are not assigned any value but are declared in the program.Trying to
read such variables gives special value called undefined value.

What is === operator ?
==== is strict equality operator ,it returns true only when the two operands are having the same value without any type conversion.

How to find the selected radio button immediately using the 'this' variable?
<script>
function favAnimal(button) {
alert('You like '+button.value+'s.');
}
</script>
<input type="radio" name="marsupial" value="kangaroo"
onchange="favAnimal(this)">Kangaroo
<br /><input type="radio" name="marsupial" value="Opossum"
onchange="favAnimal(this)">Opossum
<br /><input type="radio" name="marsupial" value="Tasmanian Tiger"
onchange="favAnimal(this)">Tasmanian Tiger

How to find radio button selection when a form is submitted?
<script type="text/javascript">
function findButton() {
var myForm = document.forms.animalForm;
var i;
for(i=0;i<myForm.marsupial.length; i++) {
if(myForm.marsupial[i].checked) {
break;
}} alert("You selected \""+myForm.marsupial[i].value+"\".");
}
</script>
<form name="animalForm" action="">
<input type="radio" name="marsupial" value="kangaroo" />Kangaroo
<br /><input type="radio" name="marsupial" value="Opossum" />Opossum
<br /><input type="radio" name="marsupial" value="Tasmanian Tiger" />Tasmanian Tiger
<input type="button" name="GO" value="GO" onclick="findButton()" />

How to disable an HTML object ?
document.getElementById("myObject").disabled = true;
To write messages to the screen without using "document.write()" ?
Changing the contents of an element is a much better solution. When the method showStatus is invoked
it will change the content of the span.
...
function showStatus(message) {
var element = document.getElementById("mystatus");
element.textContent = message; //for Firefox
element.innerHTML = message; //for IE (why can't we all just get along?)
return true;
}
<span id="mystatus">Test. </span>
...
How to Add new elements dynamically ?
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>t1</title>
<script type="text/javascript">
function addNode() {
var newP = document.createElement("p");
var textNode = document.createTextNode(" I'm a new text node");
newP.appendChild(textNode);
document.getElementById("firstP").appendChild(newP);
}
</script>
</head>

<body onload="addNode();" style=" background: url('../images/Sand-1280.jpg'); background-color:
yellow;">
<p id="firstP">firstP<p>
</body>
</html>

How to have an element invoke a javascript on selection, instead of going to a new URL: ?
<script type="text/javascript">
function pseudoHitMe() {
alert("Ouch!");
}
</script>
<a href="javascript:pseudoHitMe()">hit me</a>

How to have the status line update when the mouse goes over a link (The support of the status
line is sporadic)?

<a href="javascript.shtml"
onmouseover="window.status='Hi There!';return true"
onmouseout="window.status='';return true">Look at the Status bar</a>
Look at the Status bar as your cursor goes over the link.

How to create a popup warning box
alert('Warning: Please enter an integer between 0 and 100.');

How to create a confirmation box?
confirm("Do you really want to launch the missile?");

How to create an input box?
prompt("What is your temperature?");


How to setting a cookie with the contents of a textbox ?
Values stored in cookies may not have semicolons, commas, or spaces. You should use the handy
"escape()" function to encode the values, and "unescape()" to retrieve them.

//Sets cookie of current value for myTextBox
function TextBoxOnchange() {
var myBox = window.document.getElementById(myTextBox");
document.cookie = "myTextBox="+ escape(myBox.value) + getExpirationString();
}

//return a string like ";expires=Thu, 5 Jan 2006 16:07:52 UTC"
function getExpirationString() {
var exp = new Date();
var threemonths = exp.getTime()+(120*24*60*60*1000);
exp.setTime(threemonths);
return ";expires="+exp.toGMTString();
}

This is called from the event handler in the HTML.
<input name="myTextBox" type="text" id="myTextBox"
onchange="javascript:TextBoxOnchange()" />

How to getting values from cookies to set widgets?
function getCookieData(labelName) {
//from Danny Goodman
var labelLen = labelName.length;
// read cookie property only once for speed
var cookieData = document.cookie;
var cLen = cookieData.length;
var i = 0;
var cEnd;
while (i < cLen) {
var j = i + labelLen;
if (cookieData.substring(i,j) == labelName) {
cEnd = cookieData.indexOf(";",j);
if (cEnd == -1) {
cEnd = cookieData.length;
}
return unescape(cookieData.substring(j+1, cEnd));
} i++;
}
return "";
}
//init() is called from the body tag onload function.

function init() {
setValueFromCookie("brand");
setValueFromCookie("market");
setValueFromCookie("measure");
}

function setValueFromCookie(widget) {
if( getCookieData(widget) != "") {
document.getElementById(widget).value = getCookieData(widget);
}
}

//if you name your cookies the widget ID, you can use the following helper function
function setCookie(widget) {
document.cookie = widget + "=" +
escape(document.getElementById(widget).value) + getExpirationString();
}

How to change style on an element?
Between CSS and javascript is a weird symmetry. CSS style rules are layed on top of the DOM. The CSS property names like "font-weight" are transliterated into "myElement.style.fontWeight". The class of an element can be swapped out. For example:

document.getElementById("myText").style.color = "green";
document.getElementById("myText").style.fontSize = "20";
-ordocument.
getElementById("myText").className = "regular";

How to Handle Event Handlers?
You can add an event handler in the HTML definition of the element like this,
<script type="text/javascript"><!--
function hitme() {
alert("I've been hit!");
} // -->
</script>
<input type="button" id="hitme" name="hitme" value="hit me" onclick="hitme()"
Or, interestingly enough you can just assign the event's name on the object directly with a reference to
the method you want to assign.
<input type="button" id="hitme2" name="hitme2" value="hit me2"/>
<script type="text/javascript"><!--
function hitme2() {
alert("I've been hit too!");
}
document.getElementById("hitme2").onclick = hitme2;
 // -->
</script>

You can also use an anonymous method like this:

document.getElementById("hitme3").onclick = function () { alert("howdy!"); }

You can also use the W3C addEvventListener() method, but it does not work in IE yet:

<input type="button" id="hitme4" name="hitme4" value="hit me4"/>
<script type="text/javascript"><!--
function hitme4() {
alert("I've been hit four!");
} if(document.getElementById("hitme4").addEventListener) {
document.getElementById("hitme4").addEventListener("click", hitme4, false);
} // -->
</script>

How to remove the event listener: ?

<script type="text/javascript"><!--
document.getElementById("hitme4").removeEventListener("click", hitme4, false);
// -->
</script>

Key Events

"onkeydown", "onkeypress", "onkeyup" events are supported both in ie and standards-based browsers.

<script type="text/javascript">
function setStatus(name,evt) {
evt = (evt) ? evt : ((event) ? event : null); /* ie or standard? */
var charCode = evt.charCode;
var status = document.getElementById("keyteststatus");
var text = name +": "+evt.keyCode;
status.innerHTML = text;
status.textContent = text;
}
</script>
<form action="">
<input type="text" name="keytest" size="1" value=""
onkeyup="setStatus('keyup',event)"
onkeydown="setStatus('keydown',event)"
/>
<p id="keyteststatus">status</p>
</form>

How to make elements invisible ?
Change the "visibility" attribute of the style object associated with your element. Remember that a
hidden element still takes up space, use "display" to make the space disappear as well.

if ( x == y) {
myElement.style.visibility = 'visible';
} else {
myElement.style.visibility = 'hidden';
}

How to set the cursor to wait ?

In theory, we should cache the current state of the cursor and then put it back to its original state.
document.body.style.cursor = 'wait';
//do something interesting and time consuming
document.body.style.cursor = 'auto';

How to reload the current page ?
window.location.reload(true);

How to force a page to go to another page using JavaScript ?
<script language="JavaScript" type="text/javascript" ><!--
location.href="http://newhost/newpath/newfile.html"; //--></script>

How to convert a string to a number using JavaScript?

You can use the parseInt() and parseFloat() methods. Notice that extra letters following a valid number are ignored, which is kinda wierd but convenient at times.
parseInt("100") ==> 100
parseFloat("98.6") ==> 98.6
parseFloat("98.6 is a common temperature.") ==> 98.6
parseInt("aa") ==> Nan //Not a Number
parseInt("aa",16) ==> 170 //you can supply a radix or base

How to convert numbers to strings using JavaScript?
You can prepend the number with an empty string
var mystring = ""+myinteger;
or
var mystring = myinteger.toString();
You can specify a base for the conversion,
var myinteger = 14;
var mystring = myinteger.toString(16);

mystring will be "e".

How to test for bad numbers using JavaScript?
the global method, "isNaN()" can tell if a number has gone bad.
var temperature = parseFloat(myTemperatureWidget.value);
if(!isNaN(temperature)) {
alert("Please enter a valid temperature.");
}

What's Math Constants and Functions using JavaScript?
The Math object contains useful constants such as Math.PI, Math.E
Math also has a zillion helpful functions.
Math.abs(value); //absolute value
Math.max(value1, value2); //find the largest
Math.random() //generate a decimal number between 0 and 1
Math.floor(Math.random()*101) //generate a decimal number between 0 and 100
What's the Date object using JavaScript?
Time inside a date object is stored as milliseconds since Jan 1, 1970.
new Date(06,01,02) // produces "Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)"
new Date(06,01,02).toLocaleString() // produces "Friday, February 02, 1906 00:00:00"
new Date(06,01,02) - new Date(06,01,01) // produces "86400000"
What does the delete operator do?
The delete operator is used to delete all the variables and objects used in the program ,but it does not
delete variables declared with var keyword.
How tp create Arrays using JavaScript ?
<script type="text/javascript">
var days = new Array();
days[0] = "Sunday"
days[1] = "Monday"
days[2] = "Tuesday"
days[3] = "Wednesday"
days[4] = "Thursday"
days[5] = "Friday"
days[6] = "Saturday"

document.write("first day is "+days[0])

</script>

This produces
first day is Sunday

A more compact way of creating an array is the literal notation:
<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
document.write("first day is "+days[0]) </script>
This produces
first day is Sunday

How to delete an entry using JavaScript?
The "delete" operator removes an array element, but oddly does not change the size of the array.
<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
document.write("Number of days:"+days.length); delete days[4];
document.write("<br />Number of days:"+days.length);
</script>
This produces
Number of days:7
Number of days:7

How to use strings as array indexes using JavaScript?
Javascript does not have a true hashtable object, but through its wierdness, you can use the array as a
hashtable.

<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
for(var i=0; i < days.length; i++) {
days[days[i]] = days[i];
}

document.write("days[\"Monday\"]:"+days["Monday"]);
</script>
This produces
days["Monday"]:Monday

How to use "join()" to create a string from an array using JavaScript?
"join" concatenates the array elements with a specified seperator between them.
<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
document.write("days:"+days.join(","));
</script>
This produces
days:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
How to make a array as a stack using JavaScript?
The pop() and push() functions turn a harmless array into a stack
<script type="text/javascript">
var numbers = ["one", "two", "three", "four"];
numbers.push("five");
numbers.push("six");
document.write(numbers.pop());
document.write(numbers.pop());
document.write(numbers.pop());
</script>
This produces
sixfivefour

How to shift and unshift using JavaScript?
<script type="text/javascript">
var numbers = ["one", "two", "three", "four"];
numbers.unshift("zero");
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
</script>
This produces
zero one two
shift, unshift, push, and pop may be used on the same array. Queues are easily implemented using combinations.
How to create an object using JavaScript?
Objects can be created in many ways. One way is to create the object and add the fields directly.
<script type="text/javascript">
var myMovie = new Object();
myMovie.title = "Aliens";
myMovie.director = "James Cameron";
document.write("movie: title is \""+myMovie.title+"\"");
<
This produces
movie: title is "Aliens"

To create an object you write a method with the name of your object and invoke the method with "new".
<script type="text/javascript">
function movie(title, director) {
this.title = title;
this.director = director;
}
var aliens = new movie("Aliens","Cameron");
document.write("aliens:"+aliens.toString());
</script>
This produces
aliens:[object Object]
You can also use an abbreviated format for creating fields using a ":" to separate the name of the field from its value. This is equivalent to the above code using "this.".
<script type="text/javascript">
function movie(title, director) {
title : title;
director : director;
}
var aliens = new movie("Aliens","Cameron");
document.write("aliens:"+aliens.toString());
</script>
This produces
aliens:[object Object]
How to associate functions with objects using JavaScript?
Let's now create a custom "toString()" method for our movie object. We can embed the function
directly in the object like this.

<script type="text/javascript">
function movie(title, director) {
this.title = title;
this.director = director;
this.toString = function movieToString() {
return("title: "+this.title+" director: "+this.director);
}}
var narnia = new movie("Narni","Andrew Adamson");
document.write(narnia.toString());
</script>

This produces
title: Narni director: Andrew Adamson

Or we can use a previously defined function and assign it to a variable. Note that the name of the
function is not followed by parenthesis, otherwise it would just execute the function and stuff the
returned value into the variable.

<script type="text/javascript">
function movieToString() {
return("title: "+this.title+" director: "+this.director);
}
function movie(title, director) {
this.title = title;
this.director = director;
this.toString = movieToString; //assign function to this method pointer
}
var aliens = new movie("Aliens","Cameron");
document.write(aliens.toString());
</script>
This produces
title: Aliens director: Cameron

eval()?
The eval() method is incredibly powerful allowing you to execute snippets of code during execution.
<script type="text/javascript">
var USA_Texas_Austin = "521,289";
document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
</script>
This produces
Population is 521,289

What does break and continue statements do?
Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.

How to create a function using function constructor?

The following example illustrates this
It creates a function called square with argument x and returns x multiplied by itself.
var square = new Function ("x","return x*x");

What's Prototypes for JavaScript?

Objects have "prototypes" from which they may inherit fields and functions.
<script type="text/javascript">
function movieToString() {
return("title: "+this.title+" director: "+this.director);
}
function movie(title, director) {
this.title = title;
this.director = director || "unknown"; //if null assign to "unknown"
this.toString = movieToString; //assign function to this method pointer
}
movie.prototype.isComedy = false; //add a field to the movie's prototype
var officeSpace = new movie("OfficeSpace");
var narnia = new movie("Narni","Andrew Adamson");
document.write(narnia.toString());
document.write("
Narnia a comedy? "+narnia.isComedy);
officeSpace.isComedy = true; //override the default just for this object
document.write("
Office Space a comedy? "+officeSpace.isComedy);
</script>

unescape(), escape()
These are similar to the decodeURI() and encodeURI(), but escape() is used for only portions of a URI.
<script type="text/javascript">
var myvalue = "Sir Walter Scott";
document.write("Original myvalue: "+myvalue);
document.write("<br />escaped: "+escape(myvalue));
document.write("<br />uri part: \"&author="+escape(myvalue)+"\"");
</script>

If you use escape() for the whole URI... well bad things happen.
<script type="text/javascript">
var uri = "http://www.google.com/search?q=sonofusion Taleyarkhan"
document.write("Original uri: "+uri);
document.write("
escaped: "+escape(uri));
v/script>
decodeURI(), encodeURI()
Many characters cannot be sent in a URL, but must be converted to their hex encoding. These functions are used to convert an entire URI (a superset of URL) to and from a format that can be sent via a URI.

<script type="text/javascript">
var uri = "http://www.google.com/search?q=sonofusion Taleyarkhan"
document.write("Original uri: "+uri);
document.write("<br />encoded: "+encodeURI(uri));
</script>


 
Photoshop Tuto Copyright © 2010 Prozine Theme is Designed by Lasantha Home | RSS Feed | Comment RSS