![]() |
|
JS Help - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Design (https://sinister.ly/Forum-Design) +--- Forum: Web Design (https://sinister.ly/Forum-Web-Design) +--- Thread: JS Help (/Thread-JS-Help) |
RE: JS Help - The Alchemist - 07-23-2013 Instead of that, do this : Code: <img name="image1" src="images/download1.png" onmouseover="this.src=someimage1.png" onclick="this.src=someimage2.png" border=0 />RE: JS Help - The Alchemist - 07-23-2013 Instead of that, do this : Code: <img name="image1" src="images/download1.png" onmouseover="this.src=someimage1.png" onclick="this.src=someimage2.png" border=0 />RE: JS Help - unnamed - 07-23-2013 (07-23-2013, 06:30 PM)The Alchemist Wrote: Instead of that, do this : I tried to insert it to the <span> and it didn't work. When I removed the <span> it showed only image1 RE: JS Help - unnamed - 07-23-2013 (07-23-2013, 06:30 PM)The Alchemist Wrote: Instead of that, do this : I tried to insert it to the <span> and it didn't work. When I removed the <span> it showed only image1 RE: JS Help - unnamed - 07-23-2013 (07-23-2013, 06:30 PM)The Alchemist Wrote: Instead of that, do this : I tried to insert it to the <span> and it didn't work. When I removed the <span> it showed only image1 RE: JS Help - Megamente - 07-24-2013 Well, i got your point. Here's the code: in the head section: Code: <script type="text/javascript">
function changeImage1() {
this.src = 'images/someimage1.png';
}
function changeImage2() {
this.src = 'images/someimage2.png';
}
</script>now that we have the defined functions, we need to call them in your html body: Code: <img name="image1" src="images/download1.png" onmouseover="changeImage1()" onclick="changeImage2()" border=0 />Hope this helps!
RE: JS Help - Megamente - 07-24-2013 Well, i got your point. Here's the code: in the head section: Code: <script type="text/javascript">
function changeImage1() {
this.src = 'images/someimage1.png';
}
function changeImage2() {
this.src = 'images/someimage2.png';
}
</script>now that we have the defined functions, we need to call them in your html body: Code: <img name="image1" src="images/download1.png" onmouseover="changeImage1()" onclick="changeImage2()" border=0 />Hope this helps!
RE: JS Help - Megamente - 07-24-2013 Well, i got your point. Here's the code: in the head section: Code: <script type="text/javascript">
function changeImage1() {
this.src = 'images/someimage1.png';
}
function changeImage2() {
this.src = 'images/someimage2.png';
}
</script>now that we have the defined functions, we need to call them in your html body: Code: <img name="image1" src="images/download1.png" onmouseover="changeImage1()" onclick="changeImage2()" border=0 />Hope this helps!
RE: JS Help - noize - 07-25-2013 I can't understand your question. You can add the JS code in an external script and call it from the HTML page, or embed it using <script> tags like this: Code: <script type="text/javascript">
function mySub() {
// do the twist here
}
function click() {
// do something onclick
}
</script>
<img src="image.jpg" onmouseover="mySub()" onclick="click()" />
<span onmouseover="mySub()">text</span>Where are you exactly trying to implement the JS code, on what event and in what element? RE: JS Help - noize - 07-25-2013 I can't understand your question. You can add the JS code in an external script and call it from the HTML page, or embed it using <script> tags like this: Code: <script type="text/javascript">
function mySub() {
// do the twist here
}
function click() {
// do something onclick
}
</script>
<img src="image.jpg" onmouseover="mySub()" onclick="click()" />
<span onmouseover="mySub()">text</span>Where are you exactly trying to implement the JS code, on what event and in what element? |