Windows 7 Support
Become a Fan of PCHF on Facebook!
User Reviews - Add Yours!
The PCHF Lounge
Go Back   PC Help Forum » Web & Networking » Web Design
Register for a Free Account

Web Design - Problems with Javascript and linking posted in the Web & Networking forums; Hi all, I have this code that gives 4 buttons and when clicked produces a pop up window, all I want to know is how I'd add an image to ...

Advertisement
Advertisement

Reply
Scan your PC for Errors
Old 01-21-2009   #1
Bronze Member
 
Join Date: Oct 2008
Location: Wales (more's the pity)
Posts: 36
PC Experience: Some Experience
Default Problems with Javascript and linking

Hi all,

I have this code that gives 4 buttons and when clicked produces a pop up window, all I want to know is how I'd add an image to that pop-up window.
I tried to use the following code to link the image with the pop up.

EG:

<FORM>
<INPUT TYPE="button" onClick="parent.location="yourpage.html">
</FORM>

This failed badly, it manages to kill whatever pop-up I try and use it with.

Here's the code I'm working with:

<HTML>
<HEAD>
<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,s crollbars=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.')
}
function ccalert2()
{
AlertCC('Alert Two', 'This script will let you place information about your product or topic of choice.')
}
function ccalert3()
{
AlertCC('Alert Three', 'This script will let you place information about your product or topic of choice.')
}
function ccalert4()
{
AlertCC('Alert Four', 'This script will let you place information about your product or topic of choice.')
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="[ Alert One ]" onClick="ccalert1()"></FORM></CENTER><p>
<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="[ Alert Two ]" onClick="ccalert2()"></FORM></CENTER><p>
<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="[ Alert Three ]" onClick="ccalert3()"></FORM></CENTER><p>
<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="[ Alert Four ]" onClick="ccalert4()"></FORM></CENTER><p>
<!-- END OF SCRIPT -->
</body>
</html>
I turned to google but could only find info on Flash buttons. You're my last hope!

Cheers.
Satyricon is offline   Reply With Quote
Old 01-21-2009   #2
Senior Member
 
Axephilic's Avatar
 
Join Date: May 2007
Location: Wisconsin, US
Posts: 1,392
PC Experience: Very Experienced
Default Re: Problems with Javascript and linking

Hi there,

HTML Code:
function ccalert1()
{
  AlertCC('Alert One', 'This script will let you place information about your product or topic of choice.')
}
function ccalert2()
{
  AlertCC('Alert Two', 'This script will let you place information about your product or topic of choice.')
}
function ccalert3()
{
  AlertCC('Alert Three', 'This script will let you place information about your product or topic of choice.')
}
function ccalert4()
{
  AlertCC('Alert Four', 'This script will let you place information about your product or topic of choice.')
}
So whichever one you want to add the image too, I would just use this:

HTML Code:
   AlertCC('Alert Four', '<img src="blah.jpg" />')
Something like that should suffice.
__________________

Axephilic is offline   Reply With Quote
Old 01-21-2009   #3
Bronze Member
 
Join Date: Oct 2008
Location: Wales (more's the pity)
Posts: 36
PC Experience: Some Experience
Default Re: Problems with Javascript and linking

Thank you so much Axephilic, I was going off my head trying to figure that out. I'd have never thought the fix could be so simple.
Satyricon is offline   Reply With Quote
Old 01-21-2009   #4
Senior Member
 
Axephilic's Avatar
 
Join Date: May 2007
Location: Wisconsin, US
Posts: 1,392
PC Experience: Very Experienced
Default Re: Problems with Javascript and linking

Your welcome, glad to help.

Marked as Answered.
__________________

Axephilic is offline   Reply With Quote

Reply

Bookmarks

Tags
answered, Answered:, javascript, linking, problems

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On




All times are GMT. The time now is 05:53 AM.
Powered by vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2