Click to See Complete Forum and Search --> : wanting to use showModalDialog


eliboone
11-18-2003, 01:51 PM
Hi, I am new to Javascript and am trying to create a message on my index.html page for visitors. I want the message to say something like "Orders placed after 3:00 p.m. on Nov 26 will be shipped Dec. 1". I would like for it to have an "OK" button for visitors to click to close the popup. What kind of code do I need to place in the parentheses after window.showModalDialog to display this message.

Thank You,

Eli Boone

www.ferretdepot.com

steelersfan88
11-18-2003, 06:44 PM
just use window.open('page.htm')

on the page, have that text and then have a button:

<input ... "button"> WITH onclick="window.close()"

u can set other things .. .go to google and search "so you want to open a window, huh", look at the htmlgoodies tutorial for specifics (i.e. height width resizabble, status, menu bar, address bar .......)

kelly johnson

Scriptage
11-18-2003, 07:24 PM
I've written you an example mate...download the attachment,
hope this helps.

eliboone
11-19-2003, 01:04 PM
Thanks for the repies. I went to the htmlgoodies website and have decided to use their "so you want to open a window, huh" script. Where do I put the javascript trigger code onLoad="openindex()" into the body of the html? I am using Macromedia Dreamweaver MX and when I go to the editable region of the body(in the code view) it just places the onLoad="openindex()" text onto the webpage.(in design view) Am I forgetting something? That is all the tutorial said to put in the body.

Thank You,

Eli Boone

TheBearMay
11-19-2003, 01:59 PM
Put it in the <body> tag, ie <body onload='openindex();'>

eliboone
11-19-2003, 04:09 PM
Dreamweaver won't allow me to insert anything in the <body> tag because it is not an editable region. Does anyone know how to make this work in dreamweaver?

Thanks,

Eli

eliboone
11-20-2003, 09:22 AM
I finally opened my file with notepad and added my javascript. Could someone please tell me if this code looks correct for adding a popup window that displays a message.

<SCRIPT LANGUAGE="JavaScript">
function openindex()
{
OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Ferret Depot Holiday Shipping Information</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=gray>")
OpenWindow.document.write("Orders placed after 3:00 p.m. CST on November")
OpenWindow.document.write("26 will be shipped on December 1.")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")

OpenWindow.document.close()
self.name="main"
}
<FORM>
<INPUT TYPE='BUTTON' VALUE='Close Window' onClick='window.close()'>
</FORM>

</script>


I placed that code in between my <head> </head> tags

I then placed this code in the body tag

<body onLoad="openindex()">


The screen is still not working. Do I have something out of place?

Thanks,

Eli