Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2008, 03:26 AM
credenscel credenscel is offline
 
Join Date: Oct 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I implement javascript into php?

I am using vbadvanced for my front page (site is http://www.wiredonhonda.com

I wanted to add to the big bulletin board section, where it starts with the "welcome to wiredonhonda.com" and then lists all the news/info about the site, a rotating banner.

allow me to elaborate:
Sites like: formulad.com or tunerzine.com use the "rotating banner" for their annoucements and that is what i would like to use on the front page while keeping the right section of the vbadvance module (log in, user cp etc) as they are.

I have the javascript code but when I paste it into the vbadvanced section it does not work. all of these codes are on for this section only:

vB code is On
Smilies are On
[IMG] code is On
HTML code is On

But: when i put the rotating banner code withing "code" tags then it works but looks something like this




would you please let me know how i can use the javascript code without the "code" tags because it just doesnt look right. It has the greyed out background and says "code" on top. I look forward to your feedback!



here's the javascript code just in case

HTML Code:
<script type="text/javascript">
var imgs1 = new Array("http://www.wiredonhonda.com/photos/eibach08/slides/eibach08001.jpg","http://www.wiredonhonda.com/photos/tonygarciacrx/slides/tonygarciacrx001.jpg","http://www.wiredonhonda.com/photos/tgpraces/slides/tgpraces095.jpg");
var lnks1 = new Array("http://www.wiredonhonda.com/vb/showthread.php?t=1185","http://www.wiredonhonda.com/vb/showthread.php?t=1133","http://www.wiredonhonda.com/vb/showthread.php?t=1079");
var alt1 = new Array();
var currentAd1 = 0;
var imgCt1 = 3;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
  banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  currentAd1++;
}
  window.setInterval("cycle1()",3000);
</script>
<a href=""http://www.wiredonhonda.com/vb/showthread.php?t=1185"" id="adLink1" target="_blank">
<img src="http://www.wiredonhonda.com/photos/eibach08/slides/eibach08001.jpg" id="adBanner1" border="0" width="468"></a>
Reply With Quote
  #2  
Old 05-29-2008, 06:22 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Script tags are not allowed, and are filtered even when you enable HTML. That looks like a bug that may exist in vBulletin.
Reply With Quote
  #3  
Old 05-29-2008, 04:55 PM
credenscel credenscel is offline
 
Join Date: Oct 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the reply. i am using vb 3.6.8 does anyone know if the latest upgrade fixes this problem? (upgrade to 3.7).. Or does anyone know how to fix the bug?
Reply With Quote
  #4  
Old 05-29-2008, 06:30 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm I am not sure but on the 2nd from last line you have:
Code:
<a href=""http://www.wiredonhonda.com/vb/showthread.php?t=1185"" id="adLink1" target="_blank">
but it should be:
Code:
<a href="http://www.wiredonhonda.com/vb/showthread.php?t=1185" id="adLink1" target="_blank">
Maybe that might help? Bit of a wild guess...
Reply With Quote
  #5  
Old 05-29-2008, 07:00 PM
credenscel credenscel is offline
 
Join Date: Oct 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no still doesnt work :-( the problem is that i cannot post javascript into vbadvanced even though HTML code is allowed.
Reply With Quote
  #6  
Old 05-29-2008, 07:06 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think javascript is allowed in order to prevent people from abusing the right to post HTML and cause damage to your site or people browsing it.

You might be able to create some custom BBCode or something, I think that allows you to use Javascript. Otherwise you will need to include your Javascript in a template and post the rest of the HTML in the post.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 07:51 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03839 seconds
  • Memory Usage 2,210KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete