473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Randy webb and others

Ok. I've quoted the inner stuff as needed.
When I click on the "form" {no errors} all I get is a momentary whiteout of
the saturn image and the saturn image returns intact.
No image swapping, no text is written.
Now what?
<script type="text/javascript">

function changeImage(imageName,imageSource,divName,divText) {
document.images[imageName].src=imageSource;
document.getElementById(divName).innerHTML = divText;
}
</script>

<form action="#">
<input type="image" src="images/thmb001.jpg" value="101"
onclick="changeImage('main','images/thmb002.jpg','sample','hello')">
</form>

<div id="sample" >

<img src="images/saturn.gif" name="main">
</div>
Jul 23 '05 #1
6 1154
Richard wrote:
Ok. I've quoted the inner stuff as needed.
When I click on the "form" {no errors} all I get is a momentary whiteout of
the saturn image and the saturn image returns intact.
You should read Richard Cornford's reply to your last thread. Stop using
a submit button for something other than what it was intended to do -
submit a form. If you test your page again, after the saturn image
returns intact, you should notice that the URL has changed and has a #
appended to the end of it. If it were not for the form submission, you
would see the text but no image.
No image swapping, no text is written.
Yes it is.
Image gets changed.
innerHTML gets changed (removing the img tag).
Form gets submitted.
Page returns unchanged (except the URL has # appended to it).
Now what?
First, you change the input type="image" to a link/image. Then, you get
the image out of the div tag.
<script type="text/javascript">

function changeImage(imageName,imageSource,divName,divText) {
document.images[imageName].src=imageSource;
document.getElementById(divName).innerHTML = divText;
}
If one wanted to get pedantic, that function lacks a lot of feature
detection that I chose to leave out of it for fear that I may have to
attempt to explain it to you.

</script>

<form action="#">
<input type="image" src="images/thmb001.jpg" value="101"
onclick="changeImage('main','images/thmb002.jpg','sample','hello')">
</form>

<div id="sample" >

<img src="images/saturn.gif" name="main">
</div>


<div id="sample"></div>
<img src="images/saturn.gif" name="main" width="XX" height="XX"
alt="----------">

<a href="images/thmb002.jpg" target="_new"
onclick="changeImage('main',this.href,'sample','he llo');
return false">
<img src="images/thmb002.jpg" border="0" width="XX" height="XX"
alt="----------">
</a>

There is a reason that I put the width, height and alt attributes in the
image tag. I will leave it up to you to attempt to discover what they
are for.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
Isn't this is the third thread in as many days on the same stuff?.
Jul 23 '05 #3
MikeB wrote:
Isn't this is the third thread in as many days on the same stuff?.


Ayup. And if we are lucky it will take less than 38 threads for RtS to
grasp the concept.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
Thanks for the assistance randy.
With your clues, I actually found a simple script that works just the way I
wanted.
Somewhat similar to your input, but a little easier for me to understand and
follow.
All I need to do now is figure out how to add the text and I'm in business.

So maybe tonight I'll have it online.

Thanks for the help.

Jul 23 '05 #5

"Randy Webb" <Hi************@aol.com> wrote in message
news:xY********************@comcast.com...
MikeB wrote:
Isn't this is the third thread in as many days on the same stuff?.
Ayup. And if we are lucky it will take less than 38 threads for RtS to
grasp the concept.


I wouldn't hold my breath..

The OPs "With your clues, I actually found a simple script that works" misses
the mark of what a "Programming Language" encapsulates.

The Idea of taking your (very own) concept and expressing what and how you want
something to happen with your (very own) interpretation of it within the
limitations of the programming language,seems to somehow have escaped the OP.

You have been too kind and verrryyy patient...
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #6
Richard wrote:
Thanks for the assistance randy.
Then please do me the favor of quoting what you are replying to.
With your clues, I actually found a simple script that works just the way I
wanted.
Somewhat similar to your input, but a little easier for me to understand and
follow.
All I need to do now is figure out how to add the text and I'm in business.
To be honest, I don't see how it could get any simpler than what I gave
you. Especially given your requests/requirements of what the script
would do. But for my own use I would use an array (or just a plain
object) and pass the reference number instead of all the text:
<script type="text/javascript">

var myArray = new Array()
myArray[0] = new Array('newImage0Name','divText0')
myArray[1] = new Array('newImage1Name','divText1')
myArray[2] = new Array('newImage2Name','divText2')
myArray[3] = new Array('newImage3Name','divText3')
myArray[4] = new Array('newImage4Name','divText4')
function changeImage(arrayEntry){
document.images['imageName'].src=myArray[arrayEntry][0];
document.getElementById('divName').innerHTML = myArray[arrayEntry][1];
}

Where divName and imageName are the names of the image/div and
hard-coded in the page.

Then, you call it thus:

onclick="changeImage(0);return false"
So maybe tonight I'll have it online.
Maybe.
Thanks for the help.


Welcome.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Visual Boodu .NET | last post by:
If you read this mate, your site has saved my life and you are a legend.
3
by: Serious_Practitioner | last post by:
Hello, all - A few days ago, I posted the following message - Hello all, and thank you for your help in the recent past. Got a new error message in the last few days. While working with...
1
by: Serious_Practitioner | last post by:
Good day - As you suggested, I got and used the right version of Jetcomp, and I also tried to run compact and repair a couple of times. I think that the compact and repair process doesn't fully...
15
by: olle | last post by:
Hi folks. I learning asp.net and compare it with traditional asp and Access-developing. The issue is this one: 1/I have this Ms Acceess adp-project application that works fine on my Ms Sql...
71
by: ROSY | last post by:
1. How would you use the functions memcpy(), memset(), memmove()?
2
by: PC Datasheet | last post by:
This is Randy Harris a liar who is insincere and a person that can not be trusted. He won't even own up to his worthless garbage by signing his name. Randy, Why don't you follow the advise of...
2
by: Joe-Paul | last post by:
Randy: Hope you get this. I am the one that wrote regarding trying to get my boss' computer screen to fit my program (rather than the other way around). Thanks for the hint. I went to the...
28
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.