javascript - onclick get thumbnail url id value -


Hope someone can help me when an onclick event occurs, but there is no luck, no idea Do I have to get thumbnail ID value? Thanks

  & lt; A href = "test.ca/images/image-1.jpg?id=1"; Onclick = "swap (this); getVa (); return back;" & Gt; This is a small thumbnail image & lt; / A & gt;  

This is JS to swap thumbnails:

  function swap (image) {document.getElementById ("main"). Src = image.href; }  

Now I want to use the id at the end of thunbnail url. Note that this URL is not a single location URL. You can use the function to get the ID:

 
var url_split = image.href.split ('='); Var id = url_split [1];

Why have not you used jQuery, although you tagged your question this way?


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -