Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add marquee to search field


mark27uk3

Recommended Posts

Posted

Hi Guys,

 

I would like to add some scrolling text inside the search field which will disappear when the customer clicks to add search text.

 

<td valign="middle" align="left" width="127" class="headerNavigationa"><?php echo tep_draw_hidden_field('inc_subcat','1') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px"') ?></td>

 

I would be grateful if someone could help out on this one, because as usual I am clueless!

 

Thanks

 

Mark :thumbsup:

Lifes a bitch, then you marry one, then you die!

Posted
Hi Guys,

 

I would like to add some scrolling text inside the search field which will disappear when the customer clicks to add search text.

 

<td valign="middle" align="left" width="127" class="headerNavigationa"><?php echo tep_draw_hidden_field('inc_subcat','1') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px"') ?></td>

 

I would be grateful if someone could help out on this one, because as usual I am clueless!

 

Thanks

 

Mark :thumbsup:

 

here is a bunch of crossbrowser scrollers ... select one, then add to the second parameter of your input field, currently ""

http://javascriptkit.com/script/cutindex3.shtml

 

you need to add an on Focus like in this field/same page

                <td class="fieldKey"><?php echo ENTRY_DATE_FROM; ?></td>
               <td class="fieldValue"><?php echo tep_draw_input_field('dfrom', DOB_FORMAT_STRING, 'onFocus="RemoveFormatString(this, \'' . DOB_FORMAT_STRING . '\')"'); ?></td>

 

the onFocus goes right behind the px" statement

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Hi Monika,

 

Thanks for the advice, How are you?? :blush:

 

I have added this to my header.php

 

<script language=JavaScript>

var newsText = new Array();
newsText[0] = "Search for Mobile Phone Accessories";

var ttloop = 1;    // Repeat forever? (1 = True; 0 = False)
var tspeed = 50;   // Typing speed in milliseconds (larger number = slower)
var tdelay = 1000; // Time delay between newsTexts in milliseconds

// ------------- NO EDITING AFTER THIS LINE ------------- \\
var dwAText, cnews=0, eline=0, cchar=0, mxText;

function doNews() {
 mxText = newsText.length - 1;
 dwAText = newsText[cnews];
 setTimeout("addChar()",1000)
}
function addNews() {
 cnews += 1;
 if (cnews <= mxText) {
   dwAText = newsText[cnews];
   if (dwAText.length != 0) {
     document.news.news2.value = "";
     eline = 0;
     setTimeout("addChar()",tspeed)
   }
 }
}
function addChar() {
 if (eline!=1) {
   if (cchar != dwAText.length) {
     nmttxt = ""; for (var k=0; k<=cchar;k++) nmttxt += dwAText.charAt(k);
     document.news.news2.value = nmttxt;
     cchar += 1;
     if (cchar != dwAText.length) document.news.news2.value += "_";
   } else {
     cchar = 0;
     eline = 1;
   }
   if (mxText==cnews && eline!=0 && ttloop!=0) {
     cnews = 0; setTimeout("addNews()",tdelay);
   } else setTimeout("addChar()",tspeed);
 } else {
   setTimeout("addNews()",tdelay)
 }
}

doNews()
</script>

 

I am just not sure how to write the onFocus bit and how to format the line correctly?! >_<

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Posted

Hi Mark,

 

plenty busy here with custom coding jobs :-) ... so nope I haven't finished the mod for newletters yet :-"

 

So for your code, you have two occurrencies in the javascript that you have to change so it uses your filed in the form ...

 

document.news.news2.value

 

has to be changed to

document.advanced_search.keywords.value

 

obviously B) , as we do not have a news form with a news2 input field!

 

then the onfocus part ...

 

add

onFocus="emptyMe()"

where I said you should

 

then add another javascript function to your header:

function emptyMe() {
var form = document.forms["advanced_search"];

form.keywords.value = "";
}

 

this is completely untested, so be aware of that ... and hey your are not messing with your live site again??? :angry:

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Hi Monika,

 

Me work on a live store (as if I would!) :P

 

I have done the changes and it works to a degree, the text I have used to scroll is 'Search for Mobile Phone Accessories' now when you view the site only the 'S' shows in the search box.

 

It does clear the form ready for input.

 

Have a look at my site to see what I mean.

 

Thanks

 

Mark :thumbsup:

Lifes a bitch, then you marry one, then you die!

Posted
Hi Monika,

 

Me work on a live store (as if I would!)  :P

 

I have done the changes and it works to a degree, the text I have used to scroll is 'Search for Mobile Phone Accessories' now when you view the site only the 'S' shows in the search box.

 

It does clear the form ready for input.

 

Have a look at my site to see what I mean.

 

Thanks

 

Mark :thumbsup:

 

 

mate, my bad. It was 3 spots to change ... go change the lats one too and it should work!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Hi Monika,

 

Thanks, that sorted it out.

 

I did not even see that one!

 

Mark

Lifes a bitch, then you marry one, then you die!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...