我有一个结构与下面类似的表格。input[type=submit]当获得焦点时,如何使用 CSS 来设置元素的样式input[type=text]?
例如:
<form id="example">
<input type="text" name="search">
<input type="submit" value="Search">
</form>
<style>
#example > input[type="text"]:focus {
// please style input[type="submit"]
}
</style>
Run Code Online (Sandbox Code Playgroud)
我正在尝试完成此任务,因为 WordPress 主题有一个搜索表单,其中包含内联的搜索输入和提交按钮。当用户专注于输入时,我希望输入字段和提交按钮具有相同的边框颜色变化。
或者,我可以围绕输入和提交按钮设置整个 div 的样式,但随后我们会回到当一个元素获得焦点时设置另一个元素的样式的问题。
这对于 CSS3 来说是可能的还是我必须求助于 javascript 函数?(最后一招。)
为什么我不能通过Javascript/Jquery获取tinymce textarea中的内容?有了我尝试的所有东西,它总是给我[object HTMLTextAreaElement]作为回应.我究竟做错了什么?
使用Javascript:
function changeText2(){
var content = tinyMCE.getContent('content');
}
alert(content);
Run Code Online (Sandbox Code Playgroud)
HTML:
<textarea id="content" onkeyup='changeText2()' name="page" cols="50" rows="15">
tinymce editable content in here
</textarea>
Run Code Online (Sandbox Code Playgroud) 我有以下PHP代码:
$xml=simplexml_load_file("http://openclipart.org/api/search/?query=dog&page=1");
echo "<ul>";
foreach ($xml->channel->item as $clipinfo):
$title=$clipinfo->title;
$full=$clipinfo->enclosure['url'];
$thumb=$clipartinfo->children('media', true)->thumbnail['url'];
echo "<div style=\"width:160px;height:120px;float:left;margin:5px;margin-top:10px;\">
<a href=\"{$full}\" target='_blank' class=\"thumbnail\">
<img alt=\"{$title}\" style=\"width: 160px; height: 120px;\" src=\"{$thumb}\">
</a>
</div>";
endforeach;
Run Code Online (Sandbox Code Playgroud)
这是由以下XML文件提供的:
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>OpenClipart.org</title>
<atom:link rel="self" href="http://openclipart.org/api/search/?query=dog&page=1" type="application/rss+xml"/>
<link>http://openclipart.org</link>
<description>Download, Sample, Cut-up, Share.</description>
<language>en-US</language>
<image>
<url>http://openclipart.org/assets/images/images/logo-no-text.jpg</url>
<link>http://openclipart.org</link>
<title>OpenClipart.org</title>
<height>93</height>
<width>114</width>
</image>
<item>
<title>walking dog</title>
<link>http://openclipart.org/detail/720/walking-dog-by-johnny_automatic</link>
<pubDate>Tue, 17 Oct 2006 21:23:37 -0400</pubDate>
<dc:creator>johnny_automatic</dc:creator>
<description>cartoon of a girl walking a dog from http://www.usda.gov/cnpp/KidsPyra/National Agricultural Library, Agricultural …Run Code Online (Sandbox Code Playgroud) 我将如何使用 PHP 来查找和回显以下字符串中的第一个锚标记?
<ul class="side-navigation">
<li><a href="/?id=12">What is RtII?</a></li>
<li><a href="/?id=13">RtII in NY</a></li>
<li><a href="/?id=14">The Tiers of RtII</a></li>
<li><a href="/?id=15">Tier A: Core</a></li>
<li><a href="/?id=16">Tier B: Supplemental</a></li>
<li><a href="/?id=17">Tier C: Intensive</a></li>
<li><a href="/?id=18">Useful Links</a></li>
<li><a href="/?id=19">Important Documents</a></li>
<li><a href="/index.php">« Go Back</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
基本上我想使用 php 最终 echo <a href="/?id=12">What is RtII?</a>。我该怎么做?
更好的是,我将如何简单地获得href="/?id=12?