0

I would like to place a image on a page

<img src="myimage.jpeg" id="imgid" style="display:none"/>

if (PerMonth <0){
  $(this).css("background-color","#FFFF00")
  $("#imgid").css("what do i need here to display different image when <0)
;}

if (PerMonth >0){
  $(this).css("background-color","#FFFF00")
  $("#imgid").css("Display different image >0)
;}

Any ideas and thanks in advance

  • I know you are doing this in SharePoint, but you should consider moving these non SharePoint questions to the more generic StackOverflow really. – Jeroen Ritmeijer - Muhimbi Aug 23 '10 at 9:39
  • @Patrick: Questions that aren't specifically about SharePoint don't belong here. Please ask your jQuery questions elsewhere unless they demonstrate integration with SharePoint. Thanks! – Alex Angas Aug 23 '10 at 23:53
0

Your .css could use the background-image property:

http://w3schools.com/css/css_background.asp

Or you may want to use simply modify the .src property instead of the .css of your jquery selector.

1

Try this,

if (PerMonth <0){ $(this).css("background-color","#FFFF00") $("#imgid").attr("src","image1.jpg") ;}

if (PerMonth >0){ $(this).css("background-color","#FFFF00") $("#imgid").attr("src","image2.jpg") ;}

Not the answer you're looking for? Browse other questions tagged or ask your own question.