Embedding an image?
3 posters
Page 1 of 1
Embedding an image?
Hey, well I've got a code that opens new content upon click
The problem is I need to put images in it. I've used the <img src="image url here"> code, it works on the first text area, but not the second, as the img code apepars to interfere with the input type code. Does anybody know how to make both "text" & "newtext" contain images?
- Spoiler:
- <span id="a">text</span><br>
<input type="button" value="Click" onclick="document.getElementById('a').innerHTML='newtext'"/>
The problem is I need to put images in it. I've used the <img src="image url here"> code, it works on the first text area, but not the second, as the img code apepars to interfere with the input type code. Does anybody know how to make both "text" & "newtext" contain images?
Last edited by notMicElf on August 30th 2009, 11:28 pm; edited 1 time in total
notMicElf- Forumember
- Posts : 377
Reputation : 0
Language : English, HTML, CSS, Java
Location : Not where you are =P
Re: Embedding an image?
Hello,
Try that:
Cordially,
ProgVal
Try that:
- Code:
<script type="text/javascript">
function myFunction()
{
document.getElementById('a').innerHTML='newtext';
}
</script>
<span id="a">text</span><br>
<input type="button" value="Click" onclick="myFunction();"/>
Cordially,
ProgVal
Re: Embedding an image?
ProgVal wrote:Hello,
Try that:Replace "newtext" by your text. If you want to use this caracter: ' put a backslash before (the backslash is: \ )
- Code:
<script type="text/javascript">
function myFunction()
{
document.getElementById('a').innerHTML='newtext';
}
</script>
<span id="a">text</span><br>
<input type="button" value="Click" onclick="myFunction();"/>
Cordially,
ProgVal
Thankyou, that code worked like a charm and performed the task I needed it too.
notMicElf- Forumember
- Posts : 377
Reputation : 0
Language : English, HTML, CSS, Java
Location : Not where you are =P
Re: Embedding an image?
Options: This will give your button 1st and 2nd images
- Spoiler:
- Code:
<span id="a"><img src="http://illiweb.com/fa/shop/en/Ban%20FM%205.png"></span><br>
<input type="button" value="Click" onclick="document.getElementById('a').innerHTML='<img src=http://illiweb.com/fa/shop/en/Ban%20FM%207.png border=0>'">
- Spoiler:
- Code:
<span id="b"><img src=http://illiweb.com/fa/shop/en/Ban%20FM%205.png border=0></span><br>
<input type="button" value="Click" onclick="document.getElementById('b').innerHTML='<a href=http://www.cafepress.com/shopmotion.292585394 target=_blank><img src=http://illiweb.com/fa/shop/en/Ban%20FM%206.png border=0>'">
Since the issue appears to be resolved, I will lock this topic. RoNo |
Similar topics
» Conflict between autolink script and image embedding
» The header image, middle image, and footer image Code for PunBB
» Embedding Code
» embedding
» Embedding
» The header image, middle image, and footer image Code for PunBB
» Embedding Code
» embedding
» Embedding
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum