fataah
07-28-2008, 05:01 PM
I am having problem poping up a survey window using javascript under php code page. Please help. I am using an exteranal javascript link
|
Click to See Complete Forum and Search --> : [RESOLVED] how to use java script in php programming code fataah 07-28-2008, 05:01 PM I am having problem poping up a survey window using javascript under php code page. Please help. I am using an exteranal javascript link nrg_alpha 07-28-2008, 05:22 PM I am assuming you want PHP to echo/print out a javascript alert() popup? something along these lines? <?php echo '<script type=\'text/javascript\'>'; echo 'alert("Hello");'; echo '</script>'; ?> Is that what you are looking for more or less? Cheers, NRG NogDog 07-28-2008, 07:08 PM In other words, the JavaScript is part of the HTML document, and so you would output it exactly the same way you would HTML: either via output functions such as echo, or by putting the JavaScript code outside of any <?php...?> tags. fataah 07-29-2008, 09:45 AM Thank you for your response. I tried to echo it and it worked in Mozilla browser but not IE, why is that. I turned off the pop up blocker too but still. Let me tell you more about it, I have created a survey and want to have a pop up window appear on my website homepage to take the survey. It is an external link from survey monkey. NogDog 07-29-2008, 10:19 AM You may need to show us your code if you want us to debug it. fataah 07-29-2008, 11:13 AM Hi, I just figure it out, it is a cookie issue not the code. As i have already mentioned it, it is working fine in Firefox. But anyways i am providing the code that i am trying to add into the home page on my site. <script src="http://www.surveymonkey.com/jsPop.aspx?sm=ft5of453L"> </script> Again thank you for your help nrg_alpha 07-29-2008, 02:20 PM well, if you go the echo root, just be mindful of the quotes used.. I personally prefer to use single quotes.. so any quotes inside should be escaped if you intend to keep the single quotes consistent.. therefore, your line above would be: echo '<script src=\'http://www.surveymonkey.com/jsPop.aspx?sm=ft5of453L\'></script>'; Cheers, NRG fataah 07-29-2008, 02:33 PM Thanks, I did try the same code but it only worked in firefox not IE. Thanks a lot for helping nrg_alpha 07-29-2008, 02:43 PM Well this is confusing.. because echo is simply a command to ouput something into your XHTML document or to the screen. So this should work on both browsers. Did you make sure that your IE's javascript is enabled? Because once PHP outputs lines like that to the HTML document and your browser reads that line, javascript must be enabled to work. so to check and see if your IE's javascripting is enabled: a) goto Tools > Internet Options b) select Security tab c) click on Internet icon d) below this is a 'Security level for this zone' panel...click on the custom level button e) scroll almost all the way down till you find a section called scripting, and right under it is a subsection called active scripting...ensure that the enabled radio button is checked on if it isn't already.. finally, click 'OK' and any further confirmations that MS throws your way. Then retry your code in IE. Cheers, NRG nrg_alpha 07-29-2008, 02:48 PM P.S You may need to restart IE after enabling active scripting (if it was disabled). NogDog 07-29-2008, 03:18 PM Could be a security setting issue if the site you are getting the javascript file is not the same domain as that of the web page requesting it. fataah 07-29-2008, 03:31 PM yes it is not the same domain. I checked the Active scripting too it is enabled. fataah 07-29-2008, 03:32 PM the confusing part is when opening up in Firefox it works but when in IE it doesn't PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved. |