Tell me how you can update a specific 'div' when you click on a button.
<script type="text/javascript"> function searchClicked() { var urequest = document.getElementById("searchform").value var scriptid = document.getElementById('myclass2') scriptid.src = 'http://gdata.youtube.com/feeds/videos?vq=' + urequest + '&max-results=8&alt=json-in-script&callback=showMyVideos&orderby=relevance&sortorder=descending&format=5&fmt=18' } </script> <div id="searchblock" class="searchblock"> <div class="formqwerty"> <input id="searchform" class="inputbox" type="text" maxlength="40" size="40" onfocus="if (this.value=='Search for something here') this.value='';" name="q"> <input onclick="searchClicked()" id="search-submit-button" class="button" type="submit" value="" onfocus="this.blur();" name="s"> </div> <div id="scriptdiv"> <script id="myclass2" src="http://gdata.youtube.com/feeds/videos?vq=&max-results=8&alt=json-in-script&callback=showMyVideos&orderby=relevance&sortorder=descending&format=5&fmt=18"></script> </div> </div>
You need to update the div with id = "scriptdiv", which contains the script with id = "myclass2". Now when you enter text into the search bar and click on the button, the "src" parameter of script id = "myclass2" is simply updated. But there is no request for an updated script. How can I update the contents of the div block id = "scriptdiv"?