<link rel="stylesheet" type="text/css" href="template/styles.css"> <script type="text/javascript" src="template/ajax.js"></script> <script type="text/javascript"> <!-- function call_lastfm(artist){ var file = 'http://ws.audioscrobbler.com/2.0/'; var artist_info = new Array(); artist_info = new sack(); artist_info.requestFile = file; artist_info.setVar('method', 'artist.getinfo'); artist_info.setVar('api_key', 'b25b959554ed76058ac220b7b2e0a026'); artist_info.setVar('artist', artist); artist_info.onCompletion = function(){ document.getElementById('artist_info').innerHTML = "<span class=\"imagefloatright\"><img src=\"" + artist_info.responseXML.getElementsByTagName('image')[2].textContent + "\" /></span>" + artist_info.responseXML.getElementsByTagName('summary')[0].textContent; } artist_info.runAJAX(); } //--> </script> <form onsubmit="call_lastfm(this.artist.value); return false;"> <input type=text name=artist> <input type=submit> </form> <div id="artist_info"></div>
$str = 'Артист - Трек'; $str_ar = explode(" - ", $str, 2); echo $str_ar[0]; // Выведет Артист echo $str_ar[1]; // Выведет Трек
var str ="artist - track"; str.split(" - "); var artist = str[0];
<form onsubmit="call_lastfm(this.artist.value); return false;">