Call image from within a javascript function? -


on this site, when user sets alarm sound , time, under "set alarm," chosen time , alarm sound appears.

i want instead of example, 2:00pm [x] (alarm set - weather) or 2:00pm [x] (alarm set - rooster) want image of weather or rooster appear instead of printing text.

this function printing text

function getalarmname(ind){     if(ind==4) return "weather";     else if(ind==3) return "flight";     else if(ind==1) return "time";     else return "rooster"; } 

i tried removing "weather," , "flight," example , adding instead image/weather.jpg , image/flight.jpg, not correct syntax.

you try this:

function getalarmname(ind){     if(ind==4) return "<img src='image/weather.jpg' />";     else if(ind==3) return "<img src='image/flight.jpg' />";     else if(ind==1) return "<img src='image/time.jpg' />";     else return "<img src='image/rooster.jpg' />"; } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -