sinryder Posted July 31, 2005 Share Posted July 31, 2005 what i am trying to do is in the email box i have the text "enter your email" but when i click on that email box to enter the email this text should disappear. can any one pleae fix this code below Full code <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => '<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" onfocus="Email.value="" checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); new infoBox($info_box_contents); ?> this is the part that i added in above code onfocus="Email.value="" thankyou Link to comment Share on other sites More sharing options...
COOLumbia Posted July 31, 2005 Share Posted July 31, 2005 this is the part that i added in above code onfocus="Email.value="" Could it be mismatched quotes? You have three double quotes and I think you need four. Or maybe use single quotes for the value and double quotes around the onfocus like this? onfocus="Email.value=' ' " Link to comment Share on other sites More sharing options...
mickeyren Posted July 31, 2005 Share Posted July 31, 2005 hi sinryder, try changing your code to this one instead: onfocus=" this.value='' ". it should work. Regards, David Ang Managing Partner Insights Web Solutions http://www.insightsws.com Best Regards, David Ang Link to comment Share on other sites More sharing options...
sinryder Posted July 31, 2005 Author Share Posted July 31, 2005 hey guys thankx for replying. tried both codes but didnt work :( code one 'text' => '<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" onfocus="Email.value="" checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); code 2 'text' => '<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" onfocus="this.value='' ". checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); even tried the code by removing the . (dot) this is the error ia m getting Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in home/public_html/includes/boxes/newsletter.php on line 90 Link to comment Share on other sites More sharing options...
boxtel Posted July 31, 2005 Share Posted July 31, 2005 hey guys thankx for replying. tried both codes but didnt work :( code one 'text' ?=> ?'<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" ?onfocus="Email.value="" checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); code 2 'text' ?=> ?'<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" onfocus="this.value='' ". checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); even tried the code by removing the . (dot) this is the error ia m getting Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in home/public_html/includes/boxes/newsletter.php on line 90 <{POST_SNAPBACK}> escape your single quotes when used within a single quotes bordered string definition like : echo tep_draw_input_field('keywords', $def_keywords, ' onfocus="this.value=\'\'" class="inputBox" size="20" maxlength="40"'); Treasurer MFC Link to comment Share on other sites More sharing options...
sinryder Posted July 31, 2005 Author Share Posted July 31, 2005 escape your single quotes when used within a single quotes bordered string definition like : echo tep_draw_input_field('keywords', $def_keywords, ' onfocus="this.value=\'\'" class="inputBox" size="20" maxlength="40"'); <{POST_SNAPBACK}> hey the error is gone now but when i click on the box the text doesnt disappear. this is the code i have 'text' => '<form name="newsletter" action="' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL') . '" method="post" onSubmit="return verify(this);">' . TEXT_EMAIL . '<br><input type="text" name="Email" value="enter your email" onfocus="Email.value=\'\"" checked size="15" maxlength="35">' . '<input type="submit" name="Submit" value="go">' . '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, '', 'NONSSL') . '"></form>'); Link to comment Share on other sites More sharing options...
COOLumbia Posted August 1, 2005 Share Posted August 1, 2005 ?onfocus="Email.value=\'\"" Boxtel suggested this (spaces added for readability): onfocus="this.value=\' \' " [single, single, double] But you have onfocus="Email.value=\' \" " [single, double, double] Don't know if that will make a difference? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.