Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BASE tag ==> jscript error

Status
Not open for further replies.

iza

Programmer
Apr 4, 2000
1,804
FR
i've got a weird error :<br><br>my header part looks like :<br>&lt;head&gt;<br>&nbsp;&lt;script langage=&quot;javascript&quot;&gt;<br>&nbsp;&nbsp;&nbsp;... some jscript<br>&nbsp;&lt;/script&gt;<br>&nbsp;&lt;style&gt;<br>&nbsp;&nbsp;&nbsp;... some css<br>&nbsp;&lt;/style&gt;<br>&lt;/head&gt;<br>and that works fine<br><br>now, i add the &lt;base ...&gt; tag, because i'm too lazy to add target=&quot;main&quot; to all my links :<br>&lt;head&gt;<br>&nbsp;&lt;base target=&quot;main&quot;&gt;<br>&nbsp;&lt;script langage=&quot;javascript&quot;&gt;<br>&nbsp;&nbsp;&nbsp;... some jscript<br>&nbsp;&lt;/script&gt;<br>&nbsp;&lt;style&gt;<br>&nbsp;&nbsp;&nbsp;... some css<br>&nbsp;&lt;/style&gt;<br>&lt;/head&gt;<br>and i get a nice jscript error : line 1 car 1 : missing object<br><br>is that ie or is it me ??? anybody seen that already ??? how can i fix it ????<br>oh and it's not the name of the frame - i've tried something else in case &quot;main&quot; was a reserved word<br><br>pliz help, or i'll have to copy past target=&quot;main&quot; a million times ;)))) !!<br>
 
Try putting the base tag as the last line of your &lt;HEAD&gt;, I think that might work... If that doesn't work... maybe in the first line of the &lt;BODY&gt;? <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
i've tried every line between the &lt;head&gt;&lt;/head&gt; !!! none works :(((<br>the really weird thing is that if i only have : &lt;head&gt;&lt;base target=&quot;main&quot;&gt;&lt;/head&gt; it works perfectly !!!<br>i'll try in the first line of the body and let you know the result .... thanxxx :)<br> <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
well try pasting your JavaScript... maybe you're missing something there. It's possible.. sometimes an error in code only shows up in certain circumstances. <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
yes, i've tried the &lt;base ..&gt; tag between head & body, or in the body : still that jscript error<br>so here's the jscript .... sorry but the variable names are in french !!<br><br>the error appears when i click that link :<br>&lt;td id=col4&gt;&lt;a href=&quot;javascript:affiche(this.document.all.col4,'PS','deepskyblue')&quot;&gt;PS&lt;/a&gt;&lt;/td&gt;<br><br>the &quot;affiche&quot; function :<br>(the object &quot;obj&quot; should get the bgcolor &quot;coul&quot;, and then all the elements which id is &quot;part&quot; should be displayed)<br>function affiche(obj, part, coul) {<br>&nbsp;raz();<br>&nbsp;if (obj.style.backgroundColor) {<br>&nbsp;&nbsp;&nbsp;obj.style.backgroundColor=coul;<br>&nbsp;&nbsp;&nbsp;change(part, 'block')<br>&nbsp;}<br>}<br><br>the &quot;raz&quot; function :<br>(it is supposed to hide everything and make all backgrounds transparents)<br>function raz(){<br>cache_tout(); // hide everything<br>pas_de_couleur(); // make all bg transparent<br>}<br><br>function pas_de_couleur(){<br>this.document.all.col1.style.backgroundColor='transparent';<br>....<br>this.document.all.col4.style.backgroundColor='transparent';<br>...<br>}<br><br>function cache_tout(){<br>change('client', 'none');<br>change('PS', 'none');<br>...<br>}<br><br>and, finally, the change function :<br>(supposed to show/hide all the elements for which id=&quot;quoi&quot;, depending on the &quot;comment&quot; parameter : if comment = none then hide, else show) <br>function change(quoi, comment) {<br>if (comment=='none' ¦¦ comment=='block') {<br> var tous_les_tags=this.document.all(quoi)<br> if (tous_les_tags!=null) <br> for (var i=0; i&lt;tous_les_tags.length; i++) <br> tous_les_tags<i>.style.display=comment;<br><br>}<br>}<br><br>without that *ù^ &lt;base ...&gt; tag, it works - of course ie only ... <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
hmm... well, it might be a missing semi-colon, but I'm not sure- could you give me the URL? <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
Dear iza,<br><br>I don't think it has anything to do with the 'base' tag<br><br>this.document.all.col4<br><br>is not anything so you are not passing a valid object to your &quot;affiche&quot; function.<br><br>You might try: document.all('col4')<br><br>It's fairly simple to debug script code using 'alert', i.e.,<br>in your affiche function your first line could be:<br><br>alert( typeof(obj));<br>then<br>alert( obj.tagName);<br><br>as a starting point for debugging.<br><br>Good luck<br>-pete
 
pete i've done that many times and as i have only ONE object whose id is col4 (my &lt;td id=col4&gt;...&lt;/td&gt;) it works great on the ie version i got (i've tried the alert(any_line_i_wrote) as well ....)<br>liam i can't coz it's not delivered to the CLIENT yet - so you won't see it before years ;]] - and even if you could it's an intranet so you're not allowed :((<br>the really really weird thing is that this error appears only if i use that base tag ... if i find where it came from i'll tell you !!!! <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
Dear iza,<br><br>&gt; pete i've done that many times and as i have only ONE object whose id is col4 <br><br>You are correct! Sorry for the inaccurate post.<br><br>-pete
 
iza,<br><br>Why are you setting a base target? do you have frames? If so your script is frame scoped! I don't use frames much but I remember having this problem. The error is because your href &quot;javascript:affiche(...)&quot; is looking in the frame named 'main' for the function and can't find it.<br><br>Check it out and let me know if this is it.<br><br>Good luck<br>-pete
 
hi pete - and thanx for your help, and for not caring too much when i'm angry on mornings and say &quot;listen pete, i've done that many times and ...&quot; ;)))<br>i think you're right, i had the same pb once and i forgot it as soon as solved -&gt; i'll fix it tomorrow but i'm already sure it was that !!!! so, thanxx again :]] <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top