Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

closed as off topic by Alex Angas Aug 23 '10 at 23:52

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I know you are doing this in SharePoint, but you should consider moving these non SharePoint questions to the more generic StackOverflow really. –  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
add comment

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
add comment

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") ;}

share|improve this answer
add comment

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