Welcome, Guest. Please Login or Register.
November 05, 2024, 10:42:31 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  English User Help  |  English Help  |  Javascript Problems « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Javascript Problems  (Read 328 times)
oldiesmann
YaBB God
*****
Posts: 577


Jesus died for your sins... Have you thanked him?

oldiesmann@oldiesmann.us WWW
Javascript Problems
« on: April 14, 2003, 10:13:50 PM »
Reply with quote

I have been going nuts here trying to get javascript to do what I want it to do... As part of my nicer move tag, I have to have it insert a bunch of options. No problem there, except that in order to get it to work, all of the options have to be defined, which creates a little bit of a problem when trying to get [move=...] to be equivalent to the default marquee tag. I figured out that if you set the bgcolor and scrollamount to "" or '', it will work. My problem comes when trying to get the surroundtext function to insert this when the user clicks on the "move" button when posting...

In subs.php, I have
'/\[move=(.+?),(.+?),(.+?),(.+?),(.+?)\](.+?)\[\/move\]/is',
which coresponds to
<marquee direction=\\1 behavior=\\2 scrollamount=\\3 bgcolor=\\4 width=\\5>\\6</marquee>

The default code in post.php for move is:
<a href="javascript:surroundText(\'[move]\',\'[/move]\')"><img src="' . $imagesdir . '/move.gif" align="bottom" width="23" height="22" alt="' . $txt[439] . '" border="0" /></a>

Now... Everything works fine if I use a default bgcolor and a default scrollamount. My problem comes when trying to get it to act like the default <marquee></marquee> tag. I figured out that if I set both bgcolor and scrollamount to '' or "", it works just like the default marquee tag. The problem is, I can't get the surroundtext function to insert either of those (two single quotes or two double quotes). If I use "", it ends the link early and cuts off the javascript, which will give me an error when I try to click the button. If I use \"\", I get an error saying "Unterminated string constant" when I click on the button. If I use '', I get a parse error, and if I use \'\', I get an error saying expected: ')' because the extra \' s in the function cause it to end early:
Quote<a href="javascript:surroundText(\'[move=left,scroll,\'\',\'\',100%]\',\'[/move]\')"><img src="' . $imagesdir . '/move.gif" align="bottom" width="23" height="22" alt="' . $txt[439] . '" border="0" /></a>

If you look at the main surroundtext() function in ubbc.js, you notice that it's defined as javascript:surroundtext(text1,text2), so according to the code above:
text1 is \'[move=left,scroll,\'
then we have \',\'
and text2 is \',100%]\'
You can see where the error is occurring. My question is, how do I get this function to do this? It works fine if I subsitute a colorname and a scrollamount number for the '' above, but I want to set it so the default is scroll left with the default scrollamount and no background color.
« Last Edit: April 14, 2003, 10:17:12 PM by oldiesmann » Logged

"I've sinned greatly, but Christ's for real, baby
It's a wonder He saved me and just didn't hate me
So won't you tell Him "Save me"
Please stand up, please stand up, please stand up..." - J. Jackson (More Info)
oldiesmann
YaBB God
*****
Posts: 577


Jesus died for your sins... Have you thanked him?

oldiesmann@oldiesmann.us WWW
Re:Javascript Problems
« Reply #1 on: April 15, 2003, 04:17:54 PM »
Reply with quote

Well, now I can get the marquee tag to work if you have it set to "bgcolor= scrollamount= ", but I'm not sure if this is going to work with the tag... I'll try it when I'm done reinstalling the board on Lycos (safe mode was making things difficult after I installed a bunch of mods).
Logged

"I've sinned greatly, but Christ's for real, baby
It's a wonder He saved me and just didn't hate me
So won't you tell Him "Save me"
Please stand up, please stand up, please stand up..." - J. Jackson (More Info)
oldiesmann
YaBB God
*****
Posts: 577


Jesus died for your sins... Have you thanked him?

oldiesmann@oldiesmann.us WWW
Re:Javascript Problems
« Reply #2 on: April 16, 2003, 03:27:39 PM »
Reply with quote

Ok. I figured out how to get it to work... Turns out the default scrollamount is 6 and using the style tag, you can set a transparent background color (ie <marquee ... style="background-color:transparent"...></marquee>). I have re-released the code for this feature (in a slightly modified form) and have set up a test place on my Lycos test board (where I can test new features before installing them on my board).
Logged

"I've sinned greatly, but Christ's for real, baby
It's a wonder He saved me and just didn't hate me
So won't you tell Him "Save me"
Please stand up, please stand up, please stand up..." - J. Jackson (More Info)
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Javascript Problems « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.076 seconds with 20 queries.