46 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Dani

A little while ago, I wrote a [tutorial](https://www.daniweb.com/programming/web-development/tutorials/537376/sanitize-php-user-input-strings) about how important it is to sanitize PHP user input strings. Not only is it important to sanitize user input being fed into a database query, but it's also important to sanitize user input being displayed to the end-user to generate valid …

2
275
Member Avatar for shilpa647

After page loading , when I click on the ellipsis , horizontal tabs transform from bottom of the product image . After opening of the tabs menu bar , first tab should open by default.I tried multiple solutions but none of them worked out.

0
211
Member Avatar for Reverend Jim

As part of a project to manage my collection of photos, I wanted to add the capability of displaying a series of files as thumbnails. This posed me with three problems: 1. how to preserve the aspect ratio of the original images 1. how to generate the thumbnails without tying …

Member Avatar for mariopepper
3
3K
Member Avatar for vegaseat

Lots of good instrumental music out on the web in the form of midi files. You can incorporate background music as part of your web page. Here is the short code.

Member Avatar for Johannes_2
0
5K
Member Avatar for rajesanthu

The Code Given is for only beginners in HTML 1.The code implements a simple login form 2.It checks whether the password and usernames are matching or not 3.While you are using replace the predefined username and password that I'v given that is replace "myuserid" and "mypswrd" with your own userid …

Member Avatar for nate_2
0
137K
Member Avatar for LONGWAY

I have a problem with the CSS for the logo. I want my logo to be in the middle horizontaly every time but my logo isnt aligned with the centered image in the backgroundand, the logo isnt right in the middle of the browser .With my css code the logo …

Member Avatar for LONGWAY
0
419
Member Avatar for BustACode

I needed a random color selector. I found one [here](http://peepspower.com/python-script-to-generate-random-css-colors). I rewrote it to make it more general purpose. "f_GenRandomColor" is the picker. The output is in list form, which should make it suitable for most general applications. "f_HTMLRandomColorChart" is just a way to create an HTML table to test …

Member Avatar for snippsat
2
522
Member Avatar for JorgeM

I have seen several posts through the years with questions about navigation menus. Menus can be built using different approaches. This example is easy to build and simple to integrate with your site. The menu is built only using HTML and CSS so you don't have to have a lot …

5
448
Member Avatar for vegaseat

Here we use the eval() function as the backbone of a simple calculator. One table is used for the display. A second table holds the buttons for the keypad. The whole thing forms an attractive looking calculator. To test it, simply paste the code into an editor like notepad and …

Member Avatar for diafol
1
2K
Member Avatar for sneekula

Draw a group of shapes on the Tkinter GUI toolkit canvas and animate the group using the common tag names.

1
5K
Member Avatar for vegaseat
Member Avatar for tekagami

**Introduction** Lets say you have a website with a mobile version and a desktop version. Pictures can be resized proportinally using css on either version. But not all html tags resize proportionally, for instance: iframes. **Javascript Function** includes: the *id* of the iframe, the *original width* and *original height* See …

Member Avatar for Hicaro_1
4
860
Member Avatar for Dani

I am often asked how to create a tableless two column CSS layout so I thought I would just post it here for once and for all.

Member Avatar for MidiMagic
2
526
Member Avatar for tekagami

Sometimes a css file wont load because of a slow connection or a conflict between scripts (or just any other reason). This specially problematic on mobile websites (looking at you IOS) where many standards are applied. So this little script will add a link tag to the head tag and …

Member Avatar for tekagami
0
268
Member Avatar for ddanbe

A modal dialog is a window that you must respond to. The MessageBox for example is such a window. It is a handy tool for displaying a warning or other kind of message to the user. But, you can configure it only in a limited way. Xcelled194 did a good …

Member Avatar for ddanbe
3
969
Member Avatar for XEN0
Member Avatar for Troy III

This code enables you to publish a CSS only with mouse click and keyboard tab image swap. Attached is a Demo example of how it would look on IE6. To ensure the greatest possible cross-browser compatibility/support this code uses CSS level 1 capabilities only. One of extra benefits is that …

Member Avatar for pol.bala
7
2K
Member Avatar for rajesanthu

[COLOR="Red"][B]SIMPLE HTML PROGRAM FOR BEGINNERS[/B][/COLOR] [COLOR="Green"][B]NB:Excuse me experts,,this is for beginners[/B][/COLOR] 1.Copy the file 2.paste it in a new notepad 3.save it with .html/.htm extension 4.chose file type as all type 5.after saving you will find an internet explorer symbol with the name that you'v given while saving,,double click it. …

Member Avatar for chriswelborn
-3
795
Member Avatar for vegaseat

Use onMouseover to change the background color of your webpage. Can be applied to change other things like images and so on.

Member Avatar for TonyG_cyprus
0
3K
Member Avatar for Troy III

# This is a simple HTML String Sanitizing tool. # ## It allows a highly rich,- but safe - html content input to be published on your pages. ## **The script code is very light and to some degree customizable.** * This function takes care of blacklisted tags, which are …

Member Avatar for Troy III
2
273
Member Avatar for cereal

Hi! *Minimize HTTP requests*. One of the suggestion I always read is to combine files, so I made a little Class that merges files on the fly, the supported formats are CSS and Javascript. With little efforts, I think, it can work fine also with JSON and CSV. Usage is …

Member Avatar for cereal
1
334
Member Avatar for Philippe.Lahaie

We have all been there, you have a centered site and some pages have enough content to fill the screen while some don't. So when you move back and forth between one that does and one that doesn't you see a small jump happen. Here is a small css fix …

Member Avatar for Philippe.Lahaie
0
2K
Member Avatar for ApocDen

This is a falling snow snippet Its very light grey its really meant for like dark backgrounds for best effect but its ok on white. its a slightly grey snow Just place the code in between tags and it should work Its too complicated to edit color unless you have …

Member Avatar for softwareforpc
0
242
Member Avatar for Luckychap

I have seen many beautiful clocks using images and and canvas and flash. So I thought of developing one with pure HTML,CSS3 and javascript, no images at all. This clock can be completely design using CSS. A brief description of Javascript used:- 'AnalogClock' is the name of the class which …

Member Avatar for Luckychap
0
476
Member Avatar for Luckychap

This is my first step towards HTML5. This is currently tested on Chrome browser where it is awesome. It will not work on FF and definitely not on IE. I am working on it. Just copy-paste the code in blank html file and run on chrome. 'Scroller' is simple menu …

Member Avatar for Luckychap
0
1K
Member Avatar for anilashanbhag

The script is used in my newest chrome app [url]https://chrome.google.com/webstore/developer/detail/bomkcodcgmbjjhogdjophonfhgpegoni/[/url] Site: [url]http://codestrix.co.cc/pixels/[/url] The above script is a good to get stated with HTML5 canvas. Much of it is named so as to be self explanatory but any doubts you are more than welcome to post it here.

Member Avatar for anilashanbhag
1
658
Member Avatar for TrustyTony

Here is code to execute these printing commands from file: [CODE]talk("How Are You") bark("I am fine") bark("...and how are you") snarl("...sorry I asked") [/CODE] from file INPUT, do printing of results to screen without tags and to file with tags, and open the html output with webbrowser.

0
311
Member Avatar for preetg

hi...... i am using window xp.....apache server m new in php i inserted record in database through forms .now i m facing problem to delete the records from database in php code..... above code is not working properly...give me solution within 2 days....

Member Avatar for didier_m
0
415
Member Avatar for ultimatebuster

This script is something i wrote during work, as I often need to do this (concatenate strings via multiple lines so it's clearer). Hopefully you guys like it.

Member Avatar for TrustyTony
0
184
Member Avatar for ApocDen

for this to work you need to add some text boxes and name them accordingly, make sure when you add a text box add [CODE]$_POST["new_text field"] = $new_text field;[/CODE] etc etc. html coding can be used within the html tags only.

Member Avatar for metalix
0
228

The End.