html

How do I make an HTML text box show a hint when empty?

I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should display the text normally (black, non-italics). This will help me avoid clutter by removing the label. BTW, this is an on-page AJAX search, ...

Relative urls for Javascript files

I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax. Ie. the same script is included on /, /help /whatever and so on, while it will always need to request from /data.json. Additionally, the sa...

Is it bad design to use table tags when displaying forms in html?

I keep hearing that div tags should be used for layout purposes and not table tags. So does that also apply to form layout? I know a form layout is still a layout, but it seems like creating form layouts with divs requires more html and css. So with that in mind, should forms layouts use div tags instead? ...

How would you achieve this table based layout using CSS instead of HTML tables?

I want the following layout to appear on the screen: FieldName 1 [Field input 1] FieldName 2 is longer [Field input 2] . . . . FieldName N [Field input N] Requirements: Field names and field inputs must align on the left edges Both columns must dynamic...

Auto-format structured data (phone, date) using jQuery plugin (or failing that vanilla JavaScript)

I like jQuery and I was wondering if anyone have used a good plugin or (non-jQuery) JavaScript library that allows for auto-formatting of structured fields like phone numbers or dates. I know of the jquery-ui-datapicker plugin, and not what I am looking for here. You may type in a phone number as 123 which then becomes (123), additiona...

Internet Explorer ol numbers appear at bottom of li instead of top as expected

I'm working on a page has an ol with nested p's, div's, and li's. Internet Explorer 6 and 7 both render the numbers for the ol tag after the p element at the end (at the very, very bottom of the li tag) rather than at the top of the outermost li as expected. I'm working on a PowerPC Mac and can't do any testing. Is there some simple CSS ...

Change the width of form elements created with ModelForm in Django

How can i change the width of a textarea form element if i used ModelForm to create it? Here is my product class: class ProductForm(ModelForm): long_desc = forms.CharField(widget=forms.Textarea) short_desc = forms.CharField(widget=forms.Textarea) class Meta: model = Product And the template code... {% for f in fo...

Regular expression to convert mark down to HTML

How would you write a regular expression to convert mark down into HTML? For example, you would type in the following: This would be *italicized* text and this would be **bold** text This would then need to be converted to: This would be <em>italicized</em> text and this would be <strong>bold</strong> text Very similar to the mark...

How should I choose between GET and POST methods in HTML forms?

I wish to know all the pros and cons about using these two methods. In particular the implications on web security. Thanks. ...

What is the difference between "lang" and "type" attributes in a script tag?

For <script> HTML tags, what is the technical difference between "lang=Javascript" and "type=text/javascript"? I usually use both, because I've always assumed that older browsers need one or the other. ...

How do I use genshi.builder to programmatically build an HTML document?

I recently discovered the genshi.builder module. It reminds me of Divmod Nevow's Stan module. How would one use genshi.builder.tag to build an HTML document with a particular doctype? Or is this even a good thing to do? If not, what is the right way? ...

Whats the best way to pass html embed code via rss feed to a rss parser in php?

Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving server? ...

Keeping my PHP pretty

I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look horrific... it really messes with the formatting and "shape...

Centered background image is off by 1px

My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;} #container{background-color:#ffffff;width:960px;text-align:left;margin:0 auto 0 auto;} I need the background image of the html...

Character Limit in HTML

How do you impliment a character limit on a textbox in HTML? I know it's a basic question, but I don't really use HTML too much, so I don't know. ...

Which CSS tag creates a box like this with title?

I want to create a box like this with title: Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style? ...

How do I cancel a text selection after the initial mousedown event?

I'm trying to implement a pop-up menu based on a click-and-hold, positioned so that a (really) slow click will still trigger the default action, and with the delay set so that a text-selection gesture won't usually trigger the menu. What I can't seem to do is cancel the text-selection in a way that doesn't prevent text-selection in th...

How to center DIV in DIV?

I'd like to ask you if anyone know how to horizontally center DIV in DIV with CSS ( if it's possible at all ). Outer DIV has 100%: <div id="outer" style="width:100%"> <div id="inner">Foo foo</div> </div> I've been searching for the solution for some time but I haven't found it anywhere yet... ...

Is there a way to get the parent URL from an Iframe's content?

I'm running an c# .net app in an iframe of an asp page on an older site. Accessing the Asp page's session information is somewhat difficult, so I'd like to make my .net app simply verify that it's being called from an approved page, or else immediately halt. Is there a way for a page to find out the url of it's parent document? ...

What is the best way to embed LaTeX in a webpage?

I'm not asking about converting a LaTeX document to html. What I'd like to be able to do is have some way to use LaTeX math commands in an html document, and have it appear correctly in a browser. This could be done server or client side. ...