473,224 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

javascript in div

I'm trying to get a simple simple simple function to execute inside a div tag and i can't get the div tag to do what it normally should do... i've searched the web for answers with no luck... here is the relevent code:
Expand|Select|Wrap|Line Numbers
  1. <style ...
  2. div.spec
  3. {
  4.     border: none;
  5.     position:absolute;
  6.     top: 300px;
  7.     left: 75px;
  8.     width:492px;
  9.     height:auto;
  10.     text-align: center;
  11. )
  12. </style>
  13. ....
  14.  
  15. <script ...
  16.  
  17. function showSpecial()
  18. {
  19. document.write("Today's Special is " + specials);
  20. }
  21.  
  22. -->
  23. </script>
  24. ..........
  25. <body ...
  26.  
  27. <div class="spec">
  28. <script type="text/javascript">
  29. <!--
  30. showSpecial();
  31. -->
  32. </script>
  33. </div>
the div shows the text... but it doesn't go where it should go... it just hangs at the top of the page... my other code free divs work fine though

please help
Sep 20 '09 #1
2 1346
Dormilich
8,658 Expert Mod 8TB
using document.write() is a very outdated way to add content. to give advice Id like to know, what you want to do there, currently I see no reason to use Javascript at all.

btw, you didnt define what the variable special is.
Sep 20 '09 #2
you can see the full code at lildaddysdowntown.com basically the script is to have the different specials show on different days........ specials is defined, i just didn't include the code above

if u look at the site, you can see the text is showing up behind the logo, not where it should be

EDIT: I found the problem and feel like an idiot i put a ) vs } by accident, but I'd still like to know some advice on a better way than using document.write()
Sep 20 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.