Virtual Mechanics: Community Forums and FAQs
Virtual Mechanics: Community Forums and FAQs
WebDwarf, SiteSpinner, SiteSpinner Pro 'How do I...'
Javascript problem|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Working Mechanic |
Hi all,
I found a script on the internet for making a pop up box when you click on a button but i cant seem to get it to work properly especially in intenet explorer. In the head section i have the following, <!-- this script got from www.javascriptfreecode.com-Coded by: Krishna Eydatoula --> <HTML> <HEAD> <!--START OF PopUp on Button Click--> <SCRIPT LANGUAGE="JavaScript"> function AlertCC(label, msg) { var cc1 = "<TITLE>Window Title</TITLE>" + "<BODY BGCOLOR='FFFFFF'><TABLE BORDER=0><TR>" + "<TD WIDTH=90% HEIGHT=90 VALIGN=TOP ALIGN=LEFT>"+ "<FONT SIZE=4 FACE=ARIAL>" var cc2 = "<FONT COLOR='FF0000'><B>"+label+"</B></FONT><BR><P>" var cc3 = "</TD><TD WIDTH=10%> </TD></TR><TR><TD> </TD>"+ "<TD VALIGN=BOTTOM ALIGN=RIGHT>"+ "<FORM><INPUT TYPE='BUTTON' VALUE='Close Window'" + "onClick='self.close()'>" + "</FORM></TD></TR></TABLE></BODY>" popup = window.open("","popDialog","height=280,width=400,scrollbars=no") popup.document.write(cc1+cc2+msg+cc3) popup.document.close() } function ccalert1() { AlertCC('Alert One', 'This script will let you place information about your product or topic of choice.') } </SCRIPT> </HEAD> and in the body section which shows the button i have the following code, <CENTER><FORM><INPUT TYPE="BUTTON" VALUE="[ More Info ]" onClick="ccalert1()"></FORM></CENTER><p> <!-- END OF SCRIPT --> When i preview in internet explorer the button works and opens a pop up window but when i upload to my sample website www.samplewebsite.org.uk it wont work. Any help will be appreciated. Thanks for your time Darren Nothing is impossible, it will just cost more! |
||
|
|
Guru 'Geezer' Mechanic |
What version of IE are you using? Its working if Firefox 3.5 and IE8.
But you have copied and pasted extra HTML codes which you do not need. Change what you have in the head to: <SCRIPT LANGUAGE="JavaScript">
function AlertCC(label, msg)
{
var cc1 =
"<TITLE>Window Title</TITLE>" +
"<BODY BGCOLOR='FFFFFF'><TABLE BORDER=0><TR>" +
"<TD WIDTH=90% HEIGHT=90 VALIGN=TOP ALIGN=LEFT>"+
"<FONT SIZE=4 FACE=ARIAL>"
var cc2 = "<FONT COLOR='FF0000'><B>"+label+"</B></FONT><BR><P>"
var cc3 =
"</TD><TD WIDTH=10%> </TD></TR><TR><TD> </TD>"+
"<TD VALIGN=BOTTOM ALIGN=RIGHT>"+
"<FORM><INPUT TYPE='BUTTON' VALUE='Close Window'" +
"onClick='self.close()'>" +
"</FORM></TD></TR></TABLE></BODY>"
popup = window.open("","popDialog","height=280,width=400,scrollbars=no")
popup.document.write(cc1+cc2+msg+cc3)
popup.document.close()
}
function ccalert1()
{
AlertCC('Alert One', 'This script will let you place information about your product or topic of choice.')
}
</SCRIPT> This removes the unneeded HTML tags and may help in your IE browser.
|
|||
|
|
Working Mechanic |
Thanks Larryd i have changed the code in the head but it still doesnt work for some reason. Im not sure what version of internet explorer im using, how i do i check which version i have?
Thanks for your time Darren Nothing is impossible, it will just cost more! |
|||
|
|
Working Mechanic |
I have internet explorer 8 as i managed to check. The pop up still will not work. When i view the web page in aol browser the pop up does work but not when i open internet explorer!
Thanks for your time Darren Nothing is impossible, it will just cost more! |
|||
|
|
Guru 'Geezer' Mechanic |
Click Help->About Internet Explorer.
When you say "it wont work", do you mean you do not see any change or do you get a new page but not a pop-up? If it just not working at all, uncheck Tools->Internet Options->Advanced->Browsing->Disable script debugging (Internet Explorer and Other options). Any error in the code that occurs will trigger an error to be displayed and may point to the problem. If you are getting a new page displayed but not a pop-up, it may be the way your IE is configured. Do you have a pop-up blocker active? |
|||
|
|
Guru 'Geezer' Mechanic |
Look at Tools->Internet Explorer->General and in the Tabs section, click the Settings button. How is the "When a pop-up is encountered:" option set?
Also, try Tools->Pop-up Blocker->Turn Off Pop-up Blocker and see if it makes a difference. |
|||
|
|
Working Mechanic |
Thanks for the help Larryd. I have unchecked the options to disable script debugging and now when i click the button i get an error message saying,
Line: 28 Error: Object required thanks for your time Darren Nothing is impossible, it will just cost more! |
|||
|
|
Guru 'Geezer' Mechanic |
I'm not getting the error in my IE8. I do not see the problem in my IE8. All the objects use in line 28 are present in the script.
Have you ever used the F12 key in IE8 and opened the developer tools? You can use it to debug the script and track down what object it is talking about. |
|||
|
|
Honorary 'Aussie' Mechanic |
I can only agree with Larry.
I tried it in IE8 and it works fine. No error messages. |
|||
|
|
Working Mechanic |
Thanks i will have another look. When i click the 'more info' button it pops up with an error message saying line 28, error object required and it asks me if i want to debug.
Thanks Darren Nothing is impossible, it will just cost more! |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

