הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   "בוצע, אך יש שגיאות בדף" - בעיה עם JS. (https://hosts.co.il/forums/showthread.php?t=88432)

dor77 10-03-11 15:34

"בוצע, אך יש שגיאות בדף" - בעיה עם JS.
 
שלום.
כאשר אני מעלה דף כלשהו שאני בונה כרגע לאינרטנט, באקספלורר הוא כותב בסטוס בר "בוצע, אך יש שגיאות בדף" וזה מציק לעין.
גיליתי שכשאר אני מסיר את השורות הללו:

PHP קוד:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>
<script type="text/javascript" src="analytics.js"></script> 

מן הדף, הכל עובד מעולה והשורה הזו לא מופיעה.
מה הבעיה?
השורות האלו נכתבות ב head.
ניסיתי להסיר שורה שורה, לא משנה מה יוצא ומה נשאר, תמיד יש שגיאות. אין שגיאות רק במידה וכל השורות האלו נמחקו.


מה לא בסדר?



תודה רבה.

Erez | TrustMedia.co.il 10-03-11 19:03

תלחץ על זה ויופיע לך חלון שאומר לך איפה השגיאה נמצאת. בד"כ זה משהו שטותי כמו פסיק בסוף מערך ודברים כאלה.

dor77 10-03-11 21:14

הוא כותב לי "שגיאת תחביר" בקובץ של אנליטס ובסקריפטים.
זה הקוד של הסקריפטים..מה לא בסדר בו?

PHP קוד:

<script type="text/javascript"
 
$(
document).ready(function() {
 
    
//Default Action
    
$(".tab_content").hide(); //Hide all content
    
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
    
$(".tab_content:first").show(); //Show first tab content
    //On Click Event
    
$("ul.tabs li").click(function() {
        $(
"ul.tabs li").removeClass("active"); //Remove any "active" class
        
$(this).addClass("active"); //Add "active" class to selected tab
        
$(".tab_content").hide(); //Hide all tab content
        
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        
$(activeTab).fadeIn(); //Fade in the active content
        
return false;
    });
});
</script>
<script type="text/javascript"> 
function search()
{
var searchb = document.getElementById("query").value;
 
if(searchb.length &lt; 1)    
{    
   var searchb = document.getElementById("query").value;
   if(searchb.length &lt; 1)
      return false;
   else
     return true;
}
}
</script>
<script type="text/javascript"> 
if (document.all)
scroller.stop()
</script> 

את זה של אנליטקס אני יוריד לגמרי, פחות משמעותי בנתיים.
מה לא בסדר בתחביר?
תודה.

BlueNosE 10-03-11 22:06

if(searchb.length &lt; 1)

אה?

~The_Sultan~ 10-03-11 22:43

ציטוט:

נכתב במקור על ידי BlueNosE (פרסם 798441)
if(searchb.length &lt; 1)

אה?

הוא התכוון ל-:
PHP קוד:

if(searchb.length 1

וזו השגיאה...

BlueNosE 10-03-11 22:50

אני יודע למה הוא התכוון, לא הבנתי איך זה הגיע לקוד.

~The_Sultan~ 11-03-11 08:35

ציטוט:

נכתב במקור על ידי BlueNosE (פרסם 798455)
אני יודע למה הוא התכוון, לא הבנתי איך זה הגיע לקוד.

אז תהיה יותר ברור! סתם |Lol|
כנראה אתר כלשהו נתן להעתיק קוד מוכן כזה והעורך של אותו אתר החליף את התווים לא כשורה.

dor77 11-03-11 15:11

לא חבר'ה, זו לא הבעיה!
כל הזמן היה שם >.
בולידציה היה כתוב שאנ אמור להחליף את זה.
עכשיו החזרתי, עדיין שגיאת תחביר בדף. הורדתי את האנליטקס, נשארה שגיאת תחביר רק בקוד הזה.
הנה הקוד:

PHP קוד:

<script type="text/javascript"
 
$(
document).ready(function() {
 
    
//Default Action
    
$(".tab_content").hide(); //Hide all content
    
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
    
$(".tab_content:first").show(); //Show first tab content
    //On Click Event
    
$("ul.tabs li").click(function() {
        $(
"ul.tabs li").removeClass("active"); //Remove any "active" class
        
$(this).addClass("active"); //Add "active" class to selected tab
        
$(".tab_content").hide(); //Hide all tab content
        
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        
$(activeTab).fadeIn(); //Fade in the active content
        
return false;
    });
});
</script>
<script type="text/javascript"> 
function search()
{
var searchb = document.getElementById("query").value;
 
if(searchb.length < 1)    
{    
   var searchb = document.getElementById("query").value;
   if(searchb.length < 1)
      return false;
   else
     return true;
}
}
</script>
<script type="text/javascript"> 
if (document.all)
scroller.stop()
</script> 

זו השגיאה:


פרטי שגיאה בדף אינטרנט

סוכן משתמש: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0)
חותמת זמן: Fri, 11 Mar 2011 13:11:56 UTC


הודעה: ‏‏שגיאת תחביר
שורה: 1
תו: 1
קוד: 0
URI: http://************/scripts.js


מה לא בסדר?
תודה!

Shay Ben Moshe 11-03-11 15:38

הסיבה היא שאתה פותח תגית html בתוך קובץ javascript מסיבה לא ברורה.

dor77 11-03-11 15:49

יצאתי הבן אדם הכי טמבל שיש.
העברתי את זה לקובץ JS חיצוני ושכחתי למחוק.

תודה, תודה.


כל הזמנים הם GMT +2. הזמן כעת הוא 18:05.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ