I want to add a small functionality to a newsletter script, however I can’t get it done properly as it results in errors in Dreamweaver:
My original code:
$data.='<input style="float:left; margin-right:10px;" type="text" id="'.$formidreal.'-wysija-to" class="'.$classValidate.'" name="wysija[user][email]" />';
I would like to add the following:
value="example@email.com" onblur="if (this.value == ''){this.value = 'example@email.com'; }" onfocus="if (this.value == 'example@email.com') {this.value = ''; }"
I am prett y sure that is has to be formatted differently to get working within PHP altough I am unable to figure it out.
Some expert advise would be very much appreciated.
Thank you very much,
Patrick
I see what you are trying to do here.
Consider using HTML5 Placeholder, that is more semantic (or if you do I.E 7.0 support then, perhaps JS is OK).
If you are comfortable with JQuery, use it.
If not, learn it.
If cannot learn now… then, PHP Code should be:
However, I would STILL recommend that you DO NOT OPT for INLINE JS.
PS: I might have made a mistake here in the code but logic is to escape using
for single and double quotes that you wish to be displayed within HTML but not compiled as end or start of a string.
Hope that helps. 🙂