Are you using the writeln() function? Can you show us all your code?
cscgal
The Queen of DaniWeb
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
I have a similar problem to this...here is where I am so far ('tis basic as I'm just testing, but I'm crap at JavaScript anyway!):
http://www.btinternet.com/~himh/rms/test2.html
Eventually I'll have about five different images, and want a different date displaying in the table cell for each image. Do I need to write a separate function for each or is there a better way (ie less code) of doing it?
Thanks.
TheAlex
Junior Poster in Training
66 posts since Feb 2005
Reputation Points: 12
Solved Threads: 2
thank you very much, i am going to try this.
a few sites suggested using innertext and i had figured that was what was causing it.
man i hate javascript. I really want to get better at it but i dont really know where to start with it.
anyone know of any good javascript editors with intellisense?
thanks though i am going to test this out right now! :)
You will not get any editor which will do whatever you want to do with JavaScript. However you may get pre made snippets and certain tool which may generate certain specific things such as Menus, SlideShows etc.... If you just want a JavaScript Editor there are several and generally every HTML Editor supports JavaScript.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
like when programming using visual studio, visual studio will finish the words and names of things when they are recognized.
Ok, so you want a JavaScript editor with intellisanse.
Well as i mentioned before there are several available and most html editor supports javascript. Some of them which have intellisance are Dreamweaver, WeBuilder, HTMLPad etc...
However if you want an editor particularly for JavaScript'ing you have 1st JavaScript Editor, Antechinus JavaScript Editor, ScrypTik - javascript editor etc etc.
However i suggest to stick with whatever you are using now for your html files until you really have very very very big work.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
Is this what you want:
I just added a new argument for the showdate function called date. Whenever you call this function you will also specify the date which would be shown in table cell using innerHTML.
Thanks, the text change is perfect. Each image also needs to be different (original and rollover), so I was wondering what the best way to do this is with minimal code?
TheAlex
Junior Poster in Training
66 posts since Feb 2005
Reputation Points: 12
Solved Threads: 2
Thanks, the text change is perfect. Each image also needs to be different (original and rollover), so I was wondering what the best way to do this is with minimal code?
same as my previous approach, just add another argument, for the rollover picture.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
I couldn't get the above to work so copied your code exactly with the relevant bits changed (as below) - the first image works but nothing happens when I rollover the second image. This is the first time I've needed JavaScript for a few years and it's made me realise I don't know much about it anymore (not that I did in the first place!)...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>change date</title>
<script type="text/javascript">
<!--
function showdate(logo, date, defPic) // defPic for rollover
{
nSRC = logo.src; // stores default picture URL
logo.src=defPic; // changes the url of image
document.getElementById("date").style.display="inline";
document.getElementById("date").innerHTML=date;
logo.onmouseout=function()
{
logo.src=nSRC; // set the URL back to it
document.getElementById("date").style.display="none";
document.getElementById("date").innerHTML="none";
}
}
-->
</script>
</head>
<body>
<table border="0">
<tr>
<td>
<a href="http://www.">
<img src="image_red.gif" onMouseOver="showdate(this, '23rd Nov, 2006','image_red_over.gif')" /></a>
<a href="http://www.">
<img src="image.gif" onMouseOver="showdate(this, '26th Nov, 2006,'image_over.gif')" /></a>
</td>
</tr>
<tr>
<td> <div id="date"></div>
</td>
</tr>
</table>
</body>
</html>
TheAlex
Junior Poster in Training
66 posts since Feb 2005
Reputation Points: 12
Solved Threads: 2
sorry i actually updated the script without checking it, might be some wrong things have crept in. I am in hurry now and will check it later after 7pm IST.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
No problemo, after going through it with a tooth-comb about five times I've fixed it. As simple as a missed apostrophe! Thanks for your help. :)
Actually, that's not my problem in the original code, but now the above works I should be able to figure it out...
TheAlex
Junior Poster in Training
66 posts since Feb 2005
Reputation Points: 12
Solved Threads: 2