Buttons that do things

  Pass text box value to javascript function when a button is pressed <script language="javascript"> //—– PLAY —– function vlc_play(uri1) { vlc_player1.play(uri1); } </script> <input id='uri' value='http://www.some_domain.com/duck.mp4' size=70 type='text'><button onclick="vlc_play($('#uri').val())">Play</button>      

Read More

Changing the contents of html elements

Element types? Can be anything, so <div id=”, <span id=”, <p id=”, etc N.B. You need to place the <script> after the HTML element, or call it within say window.onload = function() (the div or whatever tag you’ve used must be before the javascript on the page) In your html To manipulate text within a […]

Read More

Yes No Dialog that then calls PHP Function

The HTML Head <!– JQUERY UI –> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <!–Should be first script imported/first script on the page–> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/smoothness/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> <script type="text/javascript"> //—————————– //—– OUR JQUERY DIALOG —– //—————————– $(".our_jquery_dialog").live('click', function(e) { e.preventDefault(); //—– OPTIONAL GET SPECIAL VALUES INCLUDED IN THE LINK —– var usage_id = $(this).attr("usage_id"); […]

Read More

.Functions General

function functionName() { // the JavaScript you want to run } function my_function (some_value, some_other_value) { } Function Included In Definition $('#your-element-id').live('vmousedown', function() { alert("Down") });      

Read More

Calling functions from links

<a href=”javascript:void(0)” onClick=”javascript:my_function();”>Click here</a> The href can alternatively be set with the URL to use if the users doesn’t have javascript enabled, use Return false in the javascript if you don’t want the link to auto trigger

Read More

Yes Cancel Dialog Box

Resources http://jqueryui.com/demos/dialog/#modal-confirmation A Nice And Simple Dialog Box Add the following to your HTML page. At the top somewhere (Doesn't have to be in the head) <!– JQUERY UI –> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/smoothness/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> <!– div element used for confirmation and other dialogs –> <div id="dialog-confirm" style="display:none;"></div> <!– –> The […]

Read More

Javascript from a link

Running javascript in a link Just using javascript when clicked You can also use this, but the need for the “javascript:” marker is arguably annoying when adding multiple javascript commands: Using javascript in addition to a href Using multiple javascript commands Just add them one after the other Using href=”#” or href=”javascript:void(0)” href=”javascript:void(0)” is usually […]

Read More