Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ OnClick Background Image

Posted by: Kiana Marie Jun 26 2012, 04:00 PM

I've had a lot of trouble with this all day, because I am so new to HTML in general that there's a lot of basics that I don't know.
I went on another site and asked for this kind of coding, and I was given this,

"if you want to use jquery is: (first you have to put id into your link as id="link")

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$('#link').click(function(){
$('#id_background').attr('src','23lz49h.jpg');
});
});

</script>"



the conversation is all on here. http://stackoverflow.com/questions/11214326/change-a-background-image-onclick

And I'm just generally confused. All I want to do is edit this page, (www.eiramanaik.tumblr.com) so that there is a button at the top, and when you click it, the current background image, (http://i46.tinypic.com/eukfg7.jpg) is changed to, (http://i50.tinypic.com/23lz49h.jpg)


Please help! sad.gif

Posted by: Frederiek Jun 27 2012, 07:56 AM

You need to change the CSS and jQuery has a hook for that. Have a look here: http://www.jquery4u.com/dynamic-css-2/change-css-jquery/

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)