如何在单击图像时将该URL保存到sql数据库? [英] How do it so that when you click on an image it saves that url to sql database?
本文介绍了如何在单击图像时将该URL保存到sql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做标题所说的,如果我点击一个图像它将其网址保存到一个sql数据库...我知道如何做所有sql插入的东西,但我怎么做它保存网址???
我没有代码,因为我不知道从哪里开始。
解决方案
< blockquote>你可以随时从这里开始:
http:// www.htmlcodetutorial.com/forms/_INPUT_onClick.html [ ^ ]
或者这里:
http://www.w3schools.com/jsref/event_onclick.asp [ ^ ]
然后你需要编写一个方法,将URL变为变量。
一种方法是使用JavaScript。
< script>
var myURL;
function copyText()
{
myURL = document .getElementById ( field1)。value;
}
< / script>
然后将该变量保存到数据库中。
I would like to do what the title says, make it so that if i click an image it saves its url to a sql database... I know how to do all the sql insert stuff but how do i make it save the url???
I have no code because i don't know where to start.
解决方案
You can always start here:
http://www.htmlcodetutorial.com/forms/_INPUT_onClick.html[^]
or here:
http://www.w3schools.com/jsref/event_onclick.asp[^]
Then you need to write a method that gets the URL into a variable.
One way is to use JavaScript.
<script> var myURL; function copyText() { myURL = document.getElementById("field1").value; } </script>
Then save that variable into your database.
这篇关于如何在单击图像时将该URL保存到sql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文