Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Span error in function?
Old 04-08-2005, 02:25 PM Span error in function?
Novice Talker

Posts: 9
Trades: 0
I'm designing a javascript clock, but for some reasons it doesn't work in IE


WORKS
http://www.fadetolife.be/Test/a.php
http://www.fadetolife.be/Test/a.php.txt

WORKS NOT
http://www.fadetolife.be/Test/b.php
http://www.fadetolife.be/Test/b.php.txt

Could someone tell me why this doesn't work? The only difference between the 2 pages are the last 4 lines... The rest is identical!
Frederic is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-08-2005, 02:31 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
This should be in a JavaScript forum dude, you might get more response there.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-08-2005, 02:33 PM
Novice Talker

Posts: 9
Trades: 0
But isn't it about the bloody thing working in a PHP function or not? Because the JS code works fine (at http://www.fadetolife.be/Test/a.php at least)
Frederic is offline
Reply With Quote
View Public Profile
 
Old 04-08-2005, 02:48 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Oh dude i'm sorry it's me being a fool! Wasnt reading it properly. I think the problem is here:

A.
PHP Code:
if (document.layers){
                
lyr=document.layers[''+ID+''].document;
                  
lyr.open();
                  
lyr.write(WriteThis);
                  
lyr.close();
            } else if (
document.all){
                
document.all[''+ID+''].innerHTML WriteThis;
               } else if (
document.getElementById){
                
range document.createRange();
                
element document.getElementById(''+ID+'');
                
range.setStartBefore(element);
                
content range.createContextualFragment(WriteThis)
                while(
element.hasChildNodes()) element.removeChild(element.lastChild);
                
element.appendChild(content);
               } 
B.
PHP Code:
   if (document.layers){
    
lyr=document.layers[''+ID+''].document;
      
lyr.open();
      
lyr.write(WriteThis);
      
lyr.close();
    }
   else if (
document.all){
    
document.all[''+ID+''].innerHTML WriteThis;
   }    
   else if (
document.getElementById){
    
range document.createRange();
    
element document.getElementById(''+ID+'');
    
range.setStartBefore(element);
    
content range.createContextualFragment(WriteThis)
    while(
element.hasChildNodes()) element.removeChild(element.lastChild);
    
element.appendChild(content);
   }
   } 
In the B. part you need to more that last else if statement up so that it's next to the } of the previous else if.

Should sort it out
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-08-2005, 02:56 PM
Novice Talker

Posts: 9
Trades: 0
Excuse me, I don't quite got your explination right. Could you please specify?
Frederic is offline
Reply With Quote
View Public Profile
 
Old 04-08-2005, 03:14 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Sure man, sorry im having a bit of an off day today.

Find this in your code:

PHP Code:
else if (document.all){ 
    
document.all[''+ID+''].innerHTML WriteThis
   }     
   else if (
document.getElementById){ 
    
range document.createRange(); 
and change it to this:

PHP Code:
else if (document.all){ 
    
document.all[''+ID+''].innerHTML WriteThis
   } else if (
document.getElementById){ 
    
range document.createRange(); 
The else if needed to be moved up a line, otherwise PHP won't understand it.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-08-2005, 06:38 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Frederic - I can't view your links, I get a 404. How does this relate to PHP? Are you using PHP to generate the javascript for the clock?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to Span error in function?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18529 seconds with 12 queries