Wednesday, May 29, 2013

[javascript] addListener() attachEvent() onmouseover

Javascript
obj = document.getElementById('aaa')
obj.addEventListener('click',function(){alert(2)})
obj.attachEvent('onclick',function(){alert(3)})
obj.addEventListener('mouseover',f1)
function f1(){alert(5)}
                     
obj_img = document.getElementById('img1')
obj_img.addEventListener('mouseover',function(){alert(6)})
HTML
aaaaa

AAA

aaaaa
CSS
.exampleBox {
   width: 300px;
   height: 40px;
   margin: 15px 0 15px 30px;
   border: 1px solid black;
   background-color: #cccccc;
   -moz-box-shadow:inset 0 0 10px white;
   -webkit-box-shadow:inset 0 0 10px white;
   box-shadow:inset 0 0 10px white;
}
.withBackground {
  background-image: url(http://www.exratione.com/assets/color_background.png);
}
.block{
    position: relative;
}
.block .info{
    position: absolute;
    left:0px;
}
.brandimg:hover{
    opacity:0.4;
}
.withOverflowingBackground {
   position: relative; 
   background-color: transparent;
}
.withOverflowingBackground::before {
   content: " ";
   position: absolute;
   width: 500px;
   height: 40px;
   z-index: -1;
   background-image: url(http://www.exratione.com/assets/color_background.png);
}

Friday, May 17, 2013

[JavaScript]regular expression

In firefox: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp RegExp() Function
RegExp(pattern [, flags]) /pattern/flags
code:
var re = new RegExp("\\w+")
var re = /\w+/;

Properties

See also Deprecated RegExp Properties

Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.

constructor
Specifies the function that creates an object's prototype.
global lastIndex multiline source

Methods

exec
    Executes a search for a match in its string parameter.
test
    Tests for a match in its string parameter.

toSource Non-standard
    Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource method.

toString
Returns a string representing the specified object. Overrides the Object.prototype.toString method.

Saturday, May 11, 2013

[PHP]SEND JSON HEADER

use this method will be recived like a .json file:

header('Content-Type: application/json; charset=utf-8');

use this method will be recived like a .json file:

header("Content-type: text/xml; charset=utf-8")

Thursday, May 09, 2013

[PHP]receiving radio box value in php

2013/05/08
IN HTML
<input class="radio" name="radio" type="radio" value="yes" /> Yes
<input class="radio" name="radio" type="radio" value="no" /> No
if (isset($_POST['radio'])) {
  echo $_POST['radio']; 
else
 die("error");

MySQL

when we want to use command line to monitor table's foreign key. I try a approach as the following.
use INFORMATION_SCHEMA;
select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE;