[英]Button onclick display href links
Hi I have a problem that I cannot work out I have a HTML button code is below when I click this I want a java script function to run that will display links on the page and then when I press the second button I want a separate set of links to display any ideas how to do this all my HTML elements are within a 嗨,我有一个问题,我无法解决,当我单击该按钮时,下面有一个HTML按钮代码,我希望运行一个Java脚本函数,该函数将在页面上显示链接,然后当我按第二个按钮时,我需要一个单独的集合链接,以显示任何想法如何做到这一点,我所有的HTML元素都在
my HTML button is this i have put type on the button because it was acting like a submit button when it was within a form. 我的HTML按钮是我在按钮上输入类型的按钮,因为它在表单中时就像一个提交按钮。
echo"<button type=\"button\" id=\"1\" onclick =\"display(firstbox)\">";
echo "Firstbox";
echo "</button>";
this is the div that everything is displayed within 这是所有内容都在其中显示的div
echo "<div id=\"links\">
echo "</div>";
my JavaScript function is this 我的JavaScript函数是这样
$("#1").click(function(){
$("#links").text("'<div id="id">' heeellllooooo '</div>' ");
});
when I try this nothing is displayed when I get rid of the HTML elements it shows the hello is it because I have used .text do I need to change this to something else or is there a better way to do this using a different javascript or jquery functions or maybe css anything would be great 当我尝试使用HTML元素时,什么也没有显示,这表明您好,因为我使用过.text吗?我需要将其更改为其他内容吗?还是有更好的方法使用其他JavaScript或jQuery函数或CSS可能会很棒
any ideas or help would be much appreciated i just cant seem to get this to work no matter what i try 任何想法或帮助将不胜感激,无论我尝试什么,我似乎都无法使它正常工作
in the end i would like these links within the section it says hello these are the links 最后,我希望这些部分中的这些链接说“你好,这些是链接”
<br/>
<br/>
<a href="./downloads/"> Guide to Producing a Video</a>
<br /><br />
<a href="./downloads/"> Guide to Producing a Academic Exercise</a>
<br /><br />
<a href="./downloads/"> Questionnaire</a>
<br /><br />
<a href="./downloads/"> Guide to Producing a Video</a>
<br /><br />
<a href="./downloads/"> Guide to Producing a Academic Exercise</a>
<br /><br />
<a href="./downloads/"> Questionnaire</a>
problem in quotes and tag 引号和标签问题
$("#links").html("<div id='id'> heeellllooooo </div>");
if id is a javascript variable. 如果id是一个javascript变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.