Archive for the 'Web Design' Category

Change cursor style to hand

Written by coregps on Wednesday, March 19th, 2008 in Web Design.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

You might want to change the default cursor of an html element to hand. For example, an img element, something like this:

<img src=”button.gif” style=”cursor: hand” />

This works well in IE, but in Firefox, it has no effect. The correct css style should be:

<img src=”button.gif” style=”cursor: pointer” />

It works both in IE and Firefox.

Grabbing color with ColorPic

Written by coregps on Friday, December 14th, 2007 in Web Design.

colorpic.JPGColorPic is a free tool provided by IconIco. It can be used to pick any color from screen. ColorPic show colors in hex and decimal. To grab a color, just select ColorPic window and then click Ctrl + G, to cancel the grab, just press Ctrl + G again. We can also adjust color with four advanced color mixers. In addition, ColorPic has a magnifier which make it possible to pick color on a high resolution monitor.

The following are some tips of using the ColorPic provided by IconIco:

1. Grabbing Colors

To grab a color from the screen move your mouse and press the ‘Ctrl’ and ‘G’ keys on your keyboard. The selected color Chip will now say ‘Grab’. To un-grab a color just press ‘Ctrl’ and ‘G’ again.

2. Accurate Color Grabbing

Use the arrow keys on your keyboard to nudge the mouse pointer by a single pixel.

3. Selecting Chips

Use your mouse, or use the function keys on the top of your keyboard, to select color chips in your palette.

4. Small Screen Problems

Use the blue up and down toggle buttons on each of the five sections to save screen space. You can also resize the ColorPic window from the bottom right.

5. Zoom In

Change the magnification factor with the slider above the magnifier area.

6. Smooth Color Samples

Use the point size slider above the magnification area to select a single, 3×3 or 5×5 pixel point size for smoother color sampling.

7. Websafe Colors

If your selected color is not websafe click the ‘WebSnap’ button to change the color to the nearest safe value.

8. Enter an Exact Color

Using the keyboard you can type an exact value in any of the color value textboxes, including the Hue, Saturation and Value textboxes.

9. Using the Color Mixers Precisely

When using any of the color mixers and sliders you can use the arrow keys on your keyboard and your mouse wheel to nudge the color by a single step.

10. Use a Color in another Application

To use the decimal or hexadecimal color values in another application click the corresponding ‘Copy’ button. Then in your other application you can use the paste command or ‘Ctrl + V’ to insert the color value.

For more information, take a look at here.

Make Your Professional Quality Logos In Minutes

Written by coregps on Sunday, December 24th, 2006 in Web Design.

Click to create a professional logoLogoYes allows you to create a professional, custom logo for a fraction of the cost and time of traditional methods. Choose from over 20,000 unique symbols and a wide variety of fonts, colors and layout options. Thanks to an easy point & click process, you can create the perfect logo in no time.

The LogoYes process even includes a free Image CalculatorTM to help you pinpoint the best look and feel for your company’s image. In just minutes you can have your new logo on your desktop, ready for a multitude of marketing materials and your website — for a fraction of the cost of traditional methods.

Since your logo is often your customer’s first impression of your company, your logo should clearly and dynamically present your business. Don’t settle for something half-baked just because it’s low-priced. With LogoYes, you can afford a professional-quality logo, one that’s just right for you and your business, and you won’t have to sacrifice quality for affordability. No design experience is necessary.

Get a Madison Avenue quality logo on a Main Street budget with LogoYes. Our easy point & click process is based on the same basic process top design firms use, and our library of unique symbols were designed by award-winning graphic designers specifically for use in logo creation. Choose from tons of fonts, color and layout options as well. Essentially, the LogoYes logo maker combines professional graphic design expertise with the best source of information about your business and industry — you. No design experience is necessary.

Unlike logo maker software, you don’t have to download a thing or learn a new program. And you won’t be saddled with low-quality artwork or a limited, “cookie cutter” process. The award-winning team of graphic designers at LogoYes has created a library of over 20,000 unique logo symbols, each available in different illustrative styles and crafted to convey a specific image. You can create the perfect logo in minutes, get started now!.
Click Here

Create checked radio button dynamically

Written by coregps on Friday, September 22nd, 2006 in AJAX, Web Design.

I meet some trouble when creating radio buttons through javascript. My code is something like this:

function createRadioButton(elt_name, elt_value, elt_label, is_selected) {
    var inputElement = document.createElement('input');
    inputElement.setAttribute('type', 'radio');
    inputElement.setAttribute('name', elt_name);
    inputElement.setAttribute("value", elt_value);
    var func = new Function("alert(this.value + ' is selected!')");
    inputElement.onclick = func;

    if (is_selected) {
        inputElement.setAttribute("checked", "checked");
    }

    var divElement = document.getElementById("container");
    divElement.appendChild(inputElement);
    divElement.appendChild(document.createTextNode(elt_label));
    divElement.appendChild(document.createElement("br"));
}

This works perfectly in Firefox. but in Internet Explorer the radio buttons can’t be selected. After googling the internet, I find a solution which works well in IE:

var inputElement = document.createElement(’<input type=”radio” name=”‘ + elt_name + ‘” />’);

However, another problem arises. IE leaves the radio button unchecked even I set the checked status in my javascirpt like this:

inputElement.setAttribute(”checked”, “checked”);

It seems that this has no side-effect on the behavior of IE before I insert the radio button into the DOM. So I move the code used to set the checked attribute down to after the statement used to insert the radio button into the document, it works fine.

The following is the full source code:

<html>
<head>
<title>create radio button</title>
<script type="text/javascript">
function createRadioButton(elt_name, elt_value, elt_label, is_selected) {
    var inputElement;
    try{
        inputElement = document.createElement('<input type="radio" name="' + elt_name + '" />');
    }catch(err){
        inputElement = document.createElement('input');
        inputElement.setAttribute('type', 'radio');
        inputElement.setAttribute('name', elt_name);
    }
    inputElement.setAttribute("value", elt_value);
    var func = new Function("alert(this.value + ' is selected!')");
    inputElement.onclick = func;

    var divElement = document.getElementById("container");
    divElement.appendChild(inputElement);
    divElement.appendChild(document.createTextNode(elt_label));
    divElement.appendChild(document.createElement("br"));

    if (is_selected) {
        inputElement.setAttribute("checked", "checked");
    }
}
function testFunc() {
   var divElement = document.getElementById("container");

   // empty object of its children
   var len = divElement.childNodes.length;
   for (var i = 0; i < len; i++) {
       divElement.removeChild(divElement.childNodes[0]);
   }

   // alternate method
   /*
   while(divElement.hasChildNodes() == true) {
      divElement.removeChild(divElement.childNodes[0]);
   }
   */

   createRadioButton('sex', 'm', 'male', true);
   createRadioButton('sex', 'f', 'female', false);
}
</script>
</head>
<body>
<h1>Create radio button dynamically</h1>
<div id="container"></div>
<input type="button" value="Create" onclick="testFunc()" />
</body>

getElementById has no properties in Firefox

Written by coregps on Wednesday, September 6th, 2006 in AJAX, Web Design.

I have a register JSP page that contains a form with some input fields. I use the getElementById method to retrieve form values and post them through AJAX. It works very well in IE. But in Firefox, I get the following error:

document.getElementById(”customers_name”) has no properties

I reviewed the W3C’s DOM specification carefully, and found the getElementById section.

getElementById introduced in DOM Level 2
Returns the Element that has an ID attribute with the given value. If no such element exists, this returns null.

I checked my code again and found that one of the input elements has no ID attribute. It is something like this:

<input type=”text” name=”customers_name” size=”30″ />

When I assigned an ID attribute to the element, it works fine.

<input type=”text” id=”customers_name” name=”customers_name” size=”30″ />

It appears that IE does not implement the DOM 2 Core and DOM 3 Core specifications correctly. It grabs form values based on the NAME attribute. While Firefox finds form elements by ID, when the input has no ID, null is returned. So, Firefox do the right thing.



Site Navigation