的縮略圖和輸入文本我需要顯示網站的URL和縮略圖,具體取決於下拉菜單中的確定選項。我不希望他們必須點擊一個按鈕,只需選擇它並在文本框中更改圖像和URL。我在這裏有代碼,但它沒有改變任何東西。任何幫助都會很棒。更改選項
我的代碼都在一個(我使用社交媒體圖標在這個例子中)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New </title>
<script type="text/javascript">
function change_image() {
var select = document.getElementById('my_images');
var selection = select.selectedIndex;
var img = select.options[selection].value;
src = img;
}
function change_text() {
var select = document.getElementById('my_images');
var selection = select.selectedIndex;
var text = select.options[selection].id;
value = text;
}
</script>
</head>
<body>
<img id="change_this_src" src="http://cdn2.hubspot.net/hub/176530/file-18534154-jpg/images/facebook_icon_small.jpg">
<input type="text" id="change_this_text" value="" />
<form>
<select onchange="change_image(); change_text();" id='my_images'>
<option id="http://example.com?p=1!1044" value="http://cdn2.hubspot.net/hub/176530/file-18534154-jpg/images/facebook_icon_small.jpg">Facebook
<option id="http://example.com?p=2!1044" value="http://ua-mac.org/wp-content/uploads/2013/05/Twitter-5.7-for-iOS-app-icon-small.png">Twitter
<option id="http://example.com?p=3!1044" value="http://reikisanjeevani.com/wp-content/uploads/2013/10/Skype-icon_small.png">Skype
<select>
</form>
</body>
</html>
您標記的JQuery。這需要是純JS還是可以通過JQuery來完成? –