ShaolinF Posted July 9, 2007 Share Posted July 9, 2007 Hi Guys, I've made a email script to include javascript. Now what I want to do, is that I want to hide the link in status bar when I hover over it. I've implemented javascript into the code but I keep getting the following error: Parse error: syntax error, unexpected T_STRING in /home/****/public_html/fbmail/contact.php on line 12 Here is line 12: $message .= '<a href="http://www.mysite.com/" onMouseOver="window.status='Click here to continue.'; return true;" onMouseOut="window.status=''; ">Click here to continue ..</a>'; The complete code is as follows: $to = "Username <[email protected]>"; $subject = "Thank you for your email"; $headers = "From: Sender <[email protected]>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $headers .= "Reply-To: Sender <[email protected]>\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSmail-Priority: High\n"; $headers .= "X-mailer: My mailer"; $message .= '<a href="http://www.mysite.com/" onMouseOver="window.status='Click here to continue.'; return true;" onMouseOut="window.status=''; ">Click here to continue ..</a>'; mail ($to, $subject, $message, $headers) Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/ Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 I can't see anything wrong but if you use CODE tags instead of QUOTE all your code will be shown - I suspect some has been stripped out by QUOTE. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293289 Share on other sites More sharing options...
ShaolinF Posted July 9, 2007 Author Share Posted July 9, 2007 Sorry, how about now. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293292 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 Try this: $message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>'; You need to escape the single quotes used in the JS part. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293296 Share on other sites More sharing options...
ShaolinF Posted July 9, 2007 Author Share Posted July 9, 2007 Try this: $message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>'; You need to escape the single quotes used in the JS part. Thanks. Although that works when I send the email to my address the link is still visible in the status bar.. When the mouse hovers over the link it should say "Click here to continue". Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293310 Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 Try this: $message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>'; You need to escape the single quotes used in the JS part. Thanks. Although that works when I send the email to my address the link is still visible in the status bar.. When the mouse hovers over the link it should say "Click here to continue". You do know that most email clients disallow javascript in the email that is received right? Reason being is because javascript can easily be used to exploit someone's computer. I doubt this would/should work. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293320 Share on other sites More sharing options...
ShaolinF Posted July 9, 2007 Author Share Posted July 9, 2007 Ah Thanks for the info. Is there any other way around this ? I heard you could use CSS for doing the same ? Anyone have more info on that ? Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293328 Share on other sites More sharing options...
JasonLewis Posted July 9, 2007 Share Posted July 9, 2007 i would recommend taking this to the javascript board now that the php issue has been cleared up. the knowledge of javascript would be far greater over there since this is a php board. good luck with it. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293329 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 CSS can't do what you're wanting to achieve as it's only to control how a page looks. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293330 Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 Ah Thanks for the info. Is there any other way around this ? I heard you could use CSS for doing the same ? Anyone have more info on that ? Nope you are SOL. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293338 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 SOL - second time I've seen that??? Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293341 Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 Shit Out of Luck Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293375 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 lol! Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293382 Share on other sites More sharing options...
ShaolinF Posted July 9, 2007 Author Share Posted July 9, 2007 Ah jeez - What about iframe? Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293401 Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 Highly doubt it, but give it a try. You have to know that most email clients filter out that stuff or display it as just raw text for that exact reason. I could hi-jack anyone's cookies using javascript/iframe. Which is why it would, and should be disabled. I think your going to be wasting your time pursuing this any further. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293407 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 Anyway, is it really important to hide the location of the link? Even when I receive emails from friends that contain links I never click blindly on them - I always check the URL first and if it looks suspicious I check it with a script I wrote and reads the website and shows me what I could be accessing. Quote Link to comment https://forums.phpfreaks.com/topic/59078-email-scriptjavascript-help/#findComment-293415 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.