Posts Tagged ‘html’
Get Value of Checkbox using jQuery
This one is quite an easy one, but a good one to mention non-the-less as it does definitely come in really handy. If you would like to get a checkbox’s value to send to the backend using jQuery you can always do the following: Firstly let’s draw some HTML to illustrate our example. <input id="chkOurCheckbox" type="checkbox" /> Now we need some jQuery to do the real work. var ourCheckboxValue =…
HTML mail() Sending as Plain Text
$to = "email@address.com"; $subject = "SUBJECT"; $message = "<b>MESSAGE</b>"; $headers = ‘MIME-Version: 1.0′ . "\r\n"; $headers .= ‘Content-type: text/html; charset=iso-8859-1′ . "\r\n"; $headers .= ‘From: Mailer ‘ . "\r\n"; mail($to, $subject, $message, $headers); The above code does not always send emails in HTML as it should, it turns out there is a PHP Bug (http://bugs.php.net/15841) that comes into play with QMAIL and carriage returns. If this is the case you…
Stop mouse click in browsers
There have been multiple ways to stop your user/s from right clicking on your site, but many of them now fail due to the way firefox’s contextual menu loads. Below is an example of how to do it: function _c(e) {if (document.all) {if (event.button==2||event.button==3) {return false;}} else {if (e.button==2||e.button==3) {e.preventDefault();e.stopPropagation();return false;}}if (e.which) {}}if (document.all){document.onmousedown=_c;}else{document.onclick=_c;document.ondblclick=_c;}</span> ..and here is the full working example in a webpage: <html> <head> <script> function _c(e) {if…
Transparent swf in html
So you have now placed a swf file into your html page and you want to be able to see through it. Lucky for you, this is a very easy thing to do! The following code does the trick: <object type=‘application/x-shockwave-flash’ data=‘flash/home_side_left.swf’ width=’40px’ height=’550px’> <param name=‘movie’ value=‘flash/home_side_left.swf’ /> <param name=‘bgcolor’ value=‘#ffffff’> <param name=‘wmode’ value=‘transparent’> <param name=‘allowScriptAccess’ value=‘always’> </object> Notice that by just adding the ‘wmode’…
htaccess ErrorDocument
Create a file called .htaccess in the root of your public_html/htdocs of your domain. Inside add the following text: Options +FollowSymLinks AddDefaultCharset UTF-8 RewriteEngine on Options +FollowSymLinks AddDefaultCharset UTF-8 RewriteEngine on ErrorDocument 404 /index.php ErrorDocument 301 /index.php With the index.php files being the pages that get redirected to.
How to correctly form HTML
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> <script type=”text/javascript” src=”javascript/javascriptfilename.js”></script> <title>Title goes here</title> <link href=”stylesheetname.css” rel=”stylesheet” type=”text/css” /> </head> <body> Page content goes here </body> </html>
Trying to get variables into flash from the browser!
Ever wondered how to get variables from an html page to a flash element? Well, it’s quite easy using the following actionscript 2 example: I use javascript to embed my flash elements: <embed src=”somefilename.swf?varname=varvalue&vartwo=var2value” width=”550″ height=”400″></embed> Now in Flash I can just call: _root.varname and it will give us `varvalue` _root.vartwo will give us `var2value` Wasn’t that easy?