Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: A couple of problems

  1. #1
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    A couple of problems

    Ok, so I have a couple of questions/problems:

    1. I'm using the following script to change the 1st picture to the 2nd while the moues is on the 1st one and change back to the 1st one when its off the 2nd one.(its just for a div!)
    pretty easy, I think i complicated my explanation...
    mouse off - picture 1.
    mouse on - picture 2.
    mouse off - picture 1.

    Code:
    <script>
    
    <!--
    
    if (document.images)
    	{check = true;}
    	else
    	{check = false;}
    
    if (check == true){
    
    image23= new Image();
    image23.src = (image, cant post it);
    image23over = new Image();
    image23over.src = (image, cant post it);
    // There were more images, but I couldn't post them, so I deleted
    // them and left this one as an example.
    }
    
    function over(name)  {
            if (check == true){	document[name].src = eval(name + "over.src");	}}
    
    function off(name)  {
            if (check == true){	document[name].src = eval(name + ".src");}}
    
    
    //-->
    </script>
    And I call it like that: (in the body)
    Code:
    <(link, cant post it...) onmouseout="off('image23')" onmouseover="over('image23')">
    <img name="image23" src="1off.jpg" border="0"></a>
    // There were more images, but I couldn't post them, so I deleted
    // them and left this one as an example.
    Its important to remember that those are inside a div, so I gota use that compliacted script to do that simple thing.
    Now, the problem:
    When I load the page, all of the imges are [X]s and when I put my mouse over them, they become fine. But, I want the pictures to be like they are supposed to be from the beggining.

    Any suggestions?

    2. I have a clock in my site. I managed to call it only by using a form tag. I dont really care if I call it with a form tag though. But, I do care that the numbers, and characters would be centered, in a white font in the form and the form border, and background would be black. Now, I dont really know if a form tag can be manipulated to do that, so if it can't, does any one have any idea of calling the clock function in a method that would center and display in a white font the numbers and characters where i want them to be, and display them on a black background?
    The clock script is:
    Code:
    <!-- Hide the script from old browsers --
    
    	var timerID = null;
    
    	var timerRunning = false;
    
    	var id,pause=0,position=0;
    
    
    
    	function stopclock (){
    
    			if(timerRunning)
    
    					clearTimeout(timerID);
    
    			timerRunning = false;
    
    	}
    
    
    
    	function showtime () {
    
    			var now = new Date();
    
    			var hours = now.getHours();
    
    			var minutes = now.getMinutes();
    
    			var seconds = now.getSeconds()
    
    			var timeValue = "" + ((hours >12) ? hours -12 :hours)
    
    			timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    
    			timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    
    			timeValue += (hours >= 12) ? " P.M." : " A.M."
    
    			document.clock.face.value = timeValue;
    
    			timerID = setTimeout("showtime()",1000);
    
    			timerRunning = true;
    	}
    
    	function startclock () {
    
    			stopclock();
    
    			showtime();
    
    	}
    
    	// --End Hiding Here -->
    </script>
    And I call it like that:
    Code:
    <BODY onload="startclock()">
    	<form name="clock" onSubmit="0">
    	<input type="text" name="face" size="23" value="">
                 </form>
    Thanks in advanced.
    Last edited by Mers; 06-18-2009 at 03:43 PM. Reason: Some mispellings

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    NatalieM's Avatar
    NatalieM is offline Learning Programmer
    Join Date
    Jun 2009
    Location
    London, England
    Posts
    83
    Rep Power
    10

    Re: A couple of problems

    1. I'm not sure I understand your problem but is "1off.jpg" actually an image you have stored on your server? This is the one that should appear when you load the page, before any mouse event can get fired.

  4. #3
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: A couple of problems

    haha solved my problem man! thanks. Any ideas about the second one?

  5. #4
    NatalieM's Avatar
    NatalieM is offline Learning Programmer
    Join Date
    Jun 2009
    Location
    London, England
    Posts
    83
    Rep Power
    10

    Re: A couple of problems

    Quote Originally Posted by Mers View Post
    haha solved my problem man!
    Glad I could help I know there is a majority of men on here but check again my username

    As for your second problem, I don't think you can use the textAlign property on an input field so you couldn't center the text in an input form. I'm actually rather puzzled as to why you are using an input field to show the clock, it doesn't seem fit for purpose.

    You could display the clock in a div block element, which you could style as you want it with document.getElementById("myDiv").style.color/textAlign/backgroundColor and you could call it by a mouseover() event over the div element for example, or call it with an onload() event on the body.

  6. #5
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: A couple of problems

    How exactly do I do that? I'm not really a pro in javascript...

  7. #6
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: A couple of problems

    Well, I found a code somewhere... With a java applet lol... But, it works so who cares?

  8. #7
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: A couple of problems

    java applet is different and the user needs to have the java runtime files installed, not like javascript.. so it will not work for those who do not have java installed

  9. #8
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: A couple of problems

    Most of the people have a java ruintime files installed... I mean, you know java is very popular so most of the computers in the world have it, right?
    Do you have any idea with javascript?

  10. #9
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: A couple of problems

    To format the clock did you try CSS?

  11. #10
    Mers is offline Newbie
    Join Date
    Oct 2008
    Posts
    11
    Rep Power
    0

    Re: A couple of problems

    Hmmm, I thought about it, but I dont think form tags can be manipulated like that... That's also what NatalieM said.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A Couple Questions.
    By CommittedC0der in forum General Programming
    Replies: 2
    Last Post: 10-04-2010, 02:27 PM
  2. A couple of issues with 4.5.0 PB2
    By DavidBoggitt in forum ionFiles
    Replies: 5
    Last Post: 08-05-2009, 08:02 AM
  3. Couple errors please help :-D
    By JJJIrish05 in forum C and C++
    Replies: 10
    Last Post: 03-06-2008, 04:15 PM
  4. Need Help With A Couple Things
    By joebenjamin in forum C and C++
    Replies: 3
    Last Post: 09-11-2007, 08:57 AM
  5. may be off a couple days
    By littlefranciscan in forum The Lounge
    Replies: 9
    Last Post: 02-11-2007, 01:42 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts