Forum Moderators: coopster
Heres the code:
// same as access keys, but with tab indexes
$template = preg_replace ("/(\<input)(.*)[(type=\"input\")¦(type=\"submit\")¦(type=\"reset\")](.*)(\/\>)/", "\\1\\2 tabindex=\"{tabindex}\" \\4\\5", $template);// now replace all {accesskey}'s with numbers!
$counter = "1";
$tbsearch = explode ("{tabindex}", $template);
foreach ($tbsearch as $key => $value) {
if (!$key > 0) {
$tbreplaced .= $value;
} else {
// add counter and the link text!
$tbreplaced .= $counter."\"".$value;
$counter++; }
}
// set the new template
$template = $tbreplaced;
Now the problem I keep getting is that...
1. it doesn't apply the changes to just type= text submit and reset (just for testing purposes!)
2. it randomly adds them in a strange place
output code > <input .... value=" tabindex=3" />
Any ideas?
// same as access keys, but with tab indexes
$template = preg_replace ("/\<input /", "<input tabindex=\"{tabindex}\" ", $template);
$template = preg_replace ("/\<textarea /", "<textarea tabindex=\"{tabindex}\" ", $template);
// now replace all {accesskey}'s with numbers!
$counter = "1";
$tbsearch = explode ("{tabindex}", $template);
foreach ($tbsearch as $key => $value) {
if (!$key > 0) {
$tbreplaced .= $value;
} else {
// add counter and the link text!
$tbreplaced .= $counter.$value;
$counter++; }
}
// set the new template
$template = $tbreplaced;