Pages

Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Monday, March 03, 2008

Cancelling clicked href link in html

If we want to create a link which is not linked to anywhere but only want to trigger something example as follows:
<a href="#" onclick="alert('test');">...</a>

The page will scroll to the top since the link is nowhere found in that page. To disable the scroll, simply add return false like this:
<a href="#" onclick="alert('test'); return false;">...</a>

or
<a href="" onclick="alert('test'); return false;">...</a>

That's all. :)

Friday, February 01, 2008

Display flash (swf) as background in html

If we have flash embedded in a html page. Usually, it will be placed on top of other div or other components. There is a way to display other thing on top of flash, that is by adding the parameter: wmode with value opaque. Example:
<param name="wmode" value="opaque">

Or, there's a good library for embedding flash object to html by using SWFObject. It is located in here.

that's all :)

Preventing form tag create new line

To prevent form tag in html creating new line, create the css for the form with attribute display: inline;
For example, to apply it for all forms, create css as follow:
form {display: inline; }
or directly in the form:
<form style="display: inline">

That's all :)