My javascript is functioning, but also showing on my page

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

My javascript is functioning, but also showing on my page

Postposted on Wed Dec 04, 2013 4:51 pm

Hi guys,

I just quick adding Google's custom search to my website per a request from a patron.

I got it working, but I cannot for the life of me figure out why my javascript is showing up as text on the page. It functions correctly, but is also showing. Normally text in a
Code: Select all
<script>
tag would not show, right?

Check out my page: http://www.illuminatedink.com/search/

And the just do a view source and see if some of you can see something I am missing.

Thanks!
GIGABYTE GA-965P-DS3 / Q6600 @ 3.01 Ghz /
4GB RAM / Vista 64bit / EVGA GeForce 8800GTS 320MB (615/890)
Elohim
Gerbil First Class
 
Posts: 107
Joined: Fri Jan 05, 2007 9:32 pm
Location: Wisconsin, United States of America

Re: My javascript is functioning, but also showing on my pag

Postposted on Wed Dec 04, 2013 5:24 pm

Code: Select all
SCRIPT {display : inline}


That was on your CSS declaration. I have no clue why it is so :)
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
morphine
Grand Admiral Gerbil
Silver subscriber
 
 
Posts: 10025
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: My javascript is functioning, but also showing on my pag

Postposted on Wed Dec 04, 2013 5:42 pm

morphine wrote:
Code: Select all
SCRIPT {display : inline}


That was on your CSS declaration. I have no clue why it is so :)


Hmm, not sure why that was there. I just now figured out how to hide it. I set visibility on the script element to hidden. Does not seem like I should have had to, but perhaps the display:inline thing broke the normally hidden part of scripts?

Anyway, thanks for looking. I got it now!
GIGABYTE GA-965P-DS3 / Q6600 @ 3.01 Ghz /
4GB RAM / Vista 64bit / EVGA GeForce 8800GTS 320MB (615/890)
Elohim
Gerbil First Class
 
Posts: 107
Joined: Fri Jan 05, 2007 9:32 pm
Location: Wisconsin, United States of America

Re: My javascript is functioning, but also showing on my pag

Postposted on Wed Dec 04, 2013 5:55 pm

Does not seem like I should have had to, but perhaps the display:inline thing broke the normally hidden part of scripts?


That is correct. If you take the SCRIPT {display : inline} line out of your stylesheet, then you will not have to specify {visibility: hidden} on the script tag itself. It will be hidden by default.
weaktoss
Gerbil
Gold subscriber
 
 
Posts: 36
Joined: Fri Jun 07, 2013 1:09 pm

Re: My javascript is functioning, but also showing on my pag

Postposted on Wed Dec 04, 2013 6:03 pm

<script> tags by default do not show. Apply no formatting whatsoever to them.

Do not try to fix what is not broken :)
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
morphine
Grand Admiral Gerbil
Silver subscriber
 
 
Posts: 10025
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)


Return to Developer's Den

Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests