My name is King Amada, with basic knowledge of HTML and Javascript.
I want to Create a javascript button, that onclick it will open itunes and play music, i am using Mac OSX 10.8.2, and have safari browser to test my website. and i want to validate my form, i want the user not be able to submit the form without filling in all the fields, and selecting the platform, and last but not least, i want if the user select wimac, to open another music file, if wimob to open another one, please help me out.
this is my code below, help me out please?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""]http://www.w3.org/TR...nsitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>Untitled Document</title><styletype="text/css">#apDiv1 {position: absolute;width:200px;height:331px;z-index:1;left:189px;top:121px;font-style: oblique;font-weight: lighter;color:#999;background-image: url(../../Downloads/back_to_the_mac.jpg.png);}#apDiv2 {position: absolute;width:200px;height:56px;z-index:2;font-size:18px;left:0px;top:82px;}</style><scripttype="text/javascript">function MM_validateForm(){//v4.0if(document.getElementById){var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;for(i=0; i<(args.length-2); i+=3){ test=args[i+2]; val=document.getElementById(args[i]);if(val){ nm=val.name;if((val=val.value)!=""){if(test.indexOf('isEmail')!=-1){ p=val.indexOf('@');if(p<1|| p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';}elseif(test!='R'){ num = parseFloat(val);if(isNaN(val)) errors+='- '+nm+' must contain a number.\n';if(test.indexOf('inRange')!=-1){ p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1);if(num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';}}}elseif(test.charAt(0)=='R') errors +='- '+nm+' is required.\n';}}if(errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue =(errors =='');}}</script></head><bodybackground="../../Downloads/back_to_the_mac.jpg.png"><divid="apDiv1"><tablewidth="200"height="331"border="0"><formid="form1"name="form1"method="get"action="../../Movies/Music Videos/Michael Jackson - Dirty Diana - YouTube.FLV"><tr><thwidth="107"scope="col"align="left">WiName:</th><thwidth="77"scope="col"><labelfor="WName"></label><inputtype="text"name="WName"id="WName"tabindex="1"size="15"/></th></tr><tr><thscope="row"align="left">WiKey:</th><td><labelfor="Wkey"></label><inputtype="Password"name="Wkey"id="Wkey"tabindex="2"size="15"/></td></tr><tr><thscope="row"></th><td><divid="apDiv2"align="center"><hr/>Platform<hr/></div></td></tr><tr><thscope="row"align="left">WiMob:</th><td><inputtype="radio"name="radio"id="Mob"value="Mob"tabindex="3"/><labelfor="Mob"></label></td></tr><tr><thscope="row"align="left">WiWin:</th><td><inputtype="radio"name="radio"id="Win"value="Win"tabindex="4"/><labelfor="Win"></label></td></tr><tr><thscope="row"align="left">WiMac:</th><td><inputtype="radio"name="radio"id="Mac"value="Mac"tabindex="5"/><labelfor="Mac"></label></td></tr><tr><thscope="row"></th><td><inputname="Submit"type="submit"id="Submit"tabindex="6"onclick="MM_validateForm('WName','','R','Wkey','','R');return document.MM_returnValue"value="Submit"/></td></tr></form></table></div></body></html>
I need Help in writing Javascript to Open and Play music in iTunes by clicking a Submit button
in JavaScript
Posted
Morning to you Master of Java Programming.
My name is King Amada, with basic knowledge of HTML and Javascript.
I want to Create a javascript button, that onclick it will open itunes and play music, i am using Mac OSX 10.8.2, and have safari browser to test my website. and i want to validate my form, i want the user not be able to submit the form without filling in all the fields, and selecting the platform, and last but not least, i want if the user select wimac, to open another music file, if wimob to open another one, please help me out.
this is my code below, help me out please?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""]http://www.w3.org/TR...nsitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Untitled Document</title><style type="text/css">#apDiv1 {position: absolute;width: 200px;height: 331px;z-index: 1;left: 189px;top: 121px;font-style: oblique;font-weight: lighter;color: #999;background-image: url(../../Downloads/back_to_the_mac.jpg.png);}#apDiv2 {position: absolute;width: 200px;height: 56px;z-index: 2;font-size: 18px;left: 0px;top: 82px;}</style><script type="text/javascript">function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == '');} }</script></head><body background="../../Downloads/back_to_the_mac.jpg.png"><div id="apDiv1"> <table width="200" height="331" border="0"> <form id="form1" name="form1" method="get" action="../../Movies/Music Videos/Michael Jackson - Dirty Diana - YouTube.FLV"> <tr> <th width="107" scope="col" align="left">WiName:</th> <th width="77" scope="col"> <label for="WName"></label> <input type="text" name="WName" id="WName" tabindex="1" size="15"/> </th> </tr> <tr> <th scope="row" align="left">WiKey:</th> <td><label for="Wkey"></label> <input type="Password" name="Wkey" id="Wkey" tabindex="2" size="15" /></td> </tr> <tr> <th scope="row"> </th> <td><div id="apDiv2" align="center"><hr />Platform<hr /></div></td> </tr> <tr> <th scope="row" align="left">WiMob:</th> <td><input type="radio" name="radio" id="Mob" value="Mob" tabindex="3" /> <label for="Mob"></label></td> </tr> <tr> <th scope="row" align="left">WiWin:</th> <td><input type="radio" name="radio" id="Win" value="Win" tabindex="4" /> <label for="Win"></label></td> </tr> <tr> <th scope="row" align="left">WiMac:</th> <td><input type="radio" name="radio" id="Mac" value="Mac" tabindex="5" /> <label for="Mac"></label></td> </tr> <tr> <th scope="row"> </th> <td><input name="Submit" type="submit" id="Submit" tabindex="6" onclick="MM_validateForm('WName','','R','Wkey','','R');return document.MM_returnValue" value="Submit" /></td> </tr> </form> </table></div></body></html>
Read more:
http://forum.codecall.net/topic/73719-javascript-programming-to-play-open-and-play-itunes-music-in-itunes/#ixzz2GZDwc46I