jQuery右クリック処理

右クリック処理を書ける。キーコードの取得をonclickで

www.finefinefine.jp

-----------------------------

<p id="buttonMenu" onClick="rightClick();">右クリック検知</p>

-----------------------------

<script>
function rightClick() {
$("#buttonMenu").on('contextmenu', function(e) {
alert(e.which);
$(this).text(e.which);
$(this).css({background: '#fed9c2', border: 'solid 3px #fb5901'});
return false;
});
};
</script>

XMLの中にある「%s」などの文字をPHPで操作する。

<?php

function test () {

$xml = file_get_contents("result.xml");

$str = "<?xml version='1.0' encoding='UTF-8' ?><result><tag>%s</tag></result>";
$str2 = sprintf($str, $xml);
$string = new SimpleXMLElement($str2);
echo "<pre>" . $string->asXML() . "</pre>";

return $string->asXML();
}

echo test();

?>