reportingsjr Posted June 26, 2006 Share Posted June 26, 2006 Well, my site works best in Firefox but not in IE so I wanted to have an alert to say "You are using Internet Explorer! For the best optimization(preformance) of our website please use Firefox or Opera, both of which you can get free!"But, I think the popup blocker on IE blocked it. Any ideas on how to get past this, or do I have my coding wrong on this (sorry, im not too good at javascript. Im finally doing tutorials on it today!) <!--[if IE]><script LANGUAGE="Javascript">alert("You are using Internet Explorer! <br />For the best optimization(preformance) of our website please use <a href="http://mozilla.org">Firefox</a> or Opera, both of which you can get free!");</SCRIPT>Please download Firefox by clicking on the following banner:<br /><a href="http://www.spreadfirefox.com/?q=affiliates&id=0&t=76"><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://sfx-images.mozilla.org/affiliates/Buttons/120x60/take.gif"/></a><![endif]--> Now the code part works. Its just the popup which is basically the main part. Thanks! Link to comment Share on other sites More sharing options...
scott100 Posted June 26, 2006 Share Posted June 26, 2006 or do I have my coding wrong on this (sorry, im not too good at javascript. Im finally doing tutorials on it today!)Yes your code is the problem here You cannot use double/single quotes within each other without escaping them or used in the correct nesting order if you know what i meanalert("My name is "Scott"") this is incorrect - double within doublealert("My name is \"Scott\"") this is correct - backslash means literally print the double quotealert("My name is 'Scott'")this is correct - single used within doublealert('My name is "Scott"')this is correct - double used within singlealert('You are using Internet Explorer! <br />For the best optimization(preformance) of our website please use <a href="http://mozilla.org">Firefox</a> or Opera, both of which you can get free!');I tend to start my alert with single quotes then use double inside themIt can get trickier if the quotes go a step further, then you need to use the backslashalert('My name is "Scott\'y"'); Link to comment Share on other sites More sharing options...
Webworldx Posted June 26, 2006 Share Posted June 26, 2006 You may have seen: http://dean.edwards.name/my/misbehaviors/ which might be useful for you. Link to comment Share on other sites More sharing options...
reportingsjr Posted June 26, 2006 Author Share Posted June 26, 2006 Ah, yes the qoutes.. Thanks guys!but.. I thought you couldput breaks and stuff in it, but that didnt work? Link to comment Share on other sites More sharing options...
scott100 Posted June 26, 2006 Share Posted June 26, 2006 Ah, yes the qoutes.. Thanks guys!but.. I thought you couldput breaks and stuff in it, but that didnt work?<{POST_SNAPBACK}> Yes breaks are possible, use \n<head><script>alert("hello\nreportingsjr")</script></head> Link to comment Share on other sites More sharing options...
reportingsjr Posted June 26, 2006 Author Share Posted June 26, 2006 Can you use links or anything? Link to comment Share on other sites More sharing options...
scott100 Posted June 26, 2006 Share Posted June 26, 2006 Can you use links or anything?<{POST_SNAPBACK}> No not in a alert box, just plain text is allowed.What about a window.open() with no address bar etc? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now